Cython 3.2.0__cp39-abi3-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. Cython/Build/BuildExecutable.py +169 -0
  2. Cython/Build/Cache.py +199 -0
  3. Cython/Build/Cythonize.py +350 -0
  4. Cython/Build/Dependencies.py +1314 -0
  5. Cython/Build/Distutils.py +1 -0
  6. Cython/Build/Inline.py +463 -0
  7. Cython/Build/IpythonMagic.py +560 -0
  8. Cython/Build/SharedModule.py +94 -0
  9. Cython/Build/Tests/TestCyCache.py +194 -0
  10. Cython/Build/Tests/TestCythonizeArgsParser.py +481 -0
  11. Cython/Build/Tests/TestDependencies.py +133 -0
  12. Cython/Build/Tests/TestInline.py +177 -0
  13. Cython/Build/Tests/TestIpythonMagic.py +287 -0
  14. Cython/Build/Tests/TestRecythonize.py +212 -0
  15. Cython/Build/Tests/TestStripLiterals.py +155 -0
  16. Cython/Build/Tests/__init__.py +1 -0
  17. Cython/Build/__init__.py +11 -0
  18. Cython/CodeWriter.py +815 -0
  19. Cython/Compiler/AnalysedTreeTransforms.py +97 -0
  20. Cython/Compiler/Annotate.py +328 -0
  21. Cython/Compiler/AutoDocTransforms.py +320 -0
  22. Cython/Compiler/Buffer.py +680 -0
  23. Cython/Compiler/Builtin.py +984 -0
  24. Cython/Compiler/CmdLine.py +263 -0
  25. Cython/Compiler/Code.pxd +149 -0
  26. Cython/Compiler/Code.py +3746 -0
  27. Cython/Compiler/Code.pyd +0 -0
  28. Cython/Compiler/CodeGeneration.py +33 -0
  29. Cython/Compiler/CythonScope.py +191 -0
  30. Cython/Compiler/Dataclass.py +864 -0
  31. Cython/Compiler/DebugFlags.py +24 -0
  32. Cython/Compiler/Errors.py +297 -0
  33. Cython/Compiler/ExprNodes.py +15562 -0
  34. Cython/Compiler/FlowControl.pxd +97 -0
  35. Cython/Compiler/FlowControl.py +1451 -0
  36. Cython/Compiler/FlowControl.pyd +0 -0
  37. Cython/Compiler/FusedNode.py +971 -0
  38. Cython/Compiler/FusedNode.pyd +0 -0
  39. Cython/Compiler/Future.py +16 -0
  40. Cython/Compiler/Interpreter.py +57 -0
  41. Cython/Compiler/Lexicon.py +421 -0
  42. Cython/Compiler/LineTable.py +114 -0
  43. Cython/Compiler/LineTable.pyd +0 -0
  44. Cython/Compiler/Main.py +857 -0
  45. Cython/Compiler/MatchCaseNodes.py +259 -0
  46. Cython/Compiler/MemoryView.py +905 -0
  47. Cython/Compiler/ModuleNode.py +4235 -0
  48. Cython/Compiler/Naming.py +363 -0
  49. Cython/Compiler/Nodes.py +10831 -0
  50. Cython/Compiler/Optimize.py +5288 -0
  51. Cython/Compiler/Options.py +843 -0
  52. Cython/Compiler/ParseTreeTransforms.pxd +78 -0
  53. Cython/Compiler/ParseTreeTransforms.py +4638 -0
  54. Cython/Compiler/Parsing.pxd +9 -0
  55. Cython/Compiler/Parsing.py +4775 -0
  56. Cython/Compiler/Parsing.pyd +0 -0
  57. Cython/Compiler/Pipeline.py +439 -0
  58. Cython/Compiler/PyrexTypes.py +5870 -0
  59. Cython/Compiler/Pythran.py +232 -0
  60. Cython/Compiler/Scanning.pxd +48 -0
  61. Cython/Compiler/Scanning.py +701 -0
  62. Cython/Compiler/Scanning.pyd +0 -0
  63. Cython/Compiler/StringEncoding.py +298 -0
  64. Cython/Compiler/Symtab.py +3073 -0
  65. Cython/Compiler/Tests/TestBuffer.py +105 -0
  66. Cython/Compiler/Tests/TestBuiltin.py +72 -0
  67. Cython/Compiler/Tests/TestCmdLine.py +586 -0
  68. Cython/Compiler/Tests/TestCode.py +144 -0
  69. Cython/Compiler/Tests/TestFlowControl.py +65 -0
  70. Cython/Compiler/Tests/TestGrammar.py +202 -0
  71. Cython/Compiler/Tests/TestMemView.py +71 -0
  72. Cython/Compiler/Tests/TestParseTreeTransforms.py +285 -0
  73. Cython/Compiler/Tests/TestScanning.py +134 -0
  74. Cython/Compiler/Tests/TestSignatureMatching.py +73 -0
  75. Cython/Compiler/Tests/TestStringEncoding.py +21 -0
  76. Cython/Compiler/Tests/TestTreeFragment.py +63 -0
  77. Cython/Compiler/Tests/TestTreePath.py +103 -0
  78. Cython/Compiler/Tests/TestTypes.py +75 -0
  79. Cython/Compiler/Tests/TestUtilityLoad.py +112 -0
  80. Cython/Compiler/Tests/TestVisitor.py +61 -0
  81. Cython/Compiler/Tests/Utils.py +36 -0
  82. Cython/Compiler/Tests/__init__.py +1 -0
  83. Cython/Compiler/TreeFragment.py +278 -0
  84. Cython/Compiler/TreePath.py +303 -0
  85. Cython/Compiler/TypeInference.py +591 -0
  86. Cython/Compiler/TypeSlots.py +1174 -0
  87. Cython/Compiler/UFuncs.py +311 -0
  88. Cython/Compiler/UtilNodes.py +389 -0
  89. Cython/Compiler/UtilityCode.py +344 -0
  90. Cython/Compiler/Version.py +8 -0
  91. Cython/Compiler/Visitor.pxd +53 -0
  92. Cython/Compiler/Visitor.py +861 -0
  93. Cython/Compiler/Visitor.pyd +0 -0
  94. Cython/Compiler/__init__.py +1 -0
  95. Cython/Coverage.py +448 -0
  96. Cython/Debugger/Cygdb.py +177 -0
  97. Cython/Debugger/DebugWriter.py +82 -0
  98. Cython/Debugger/Tests/TestLibCython.py +275 -0
  99. Cython/Debugger/Tests/__init__.py +1 -0
  100. Cython/Debugger/Tests/cfuncs.c +8 -0
  101. Cython/Debugger/Tests/codefile +49 -0
  102. Cython/Debugger/Tests/test_libcython_in_gdb.py +578 -0
  103. Cython/Debugger/Tests/test_libpython_in_gdb.py +90 -0
  104. Cython/Debugger/__init__.py +1 -0
  105. Cython/Debugger/libcython.py +1548 -0
  106. Cython/Debugger/libpython.py +2821 -0
  107. Cython/Debugging.py +20 -0
  108. Cython/Distutils/__init__.py +2 -0
  109. Cython/Distutils/build_ext.py +139 -0
  110. Cython/Distutils/extension.py +96 -0
  111. Cython/Distutils/old_build_ext.py +351 -0
  112. Cython/Includes/cpython/__init__.pxd +173 -0
  113. Cython/Includes/cpython/array.pxd +178 -0
  114. Cython/Includes/cpython/bool.pxd +37 -0
  115. Cython/Includes/cpython/buffer.pxd +112 -0
  116. Cython/Includes/cpython/bytearray.pxd +33 -0
  117. Cython/Includes/cpython/bytes.pxd +200 -0
  118. Cython/Includes/cpython/cellobject.pxd +35 -0
  119. Cython/Includes/cpython/ceval.pxd +8 -0
  120. Cython/Includes/cpython/codecs.pxd +121 -0
  121. Cython/Includes/cpython/complex.pxd +60 -0
  122. Cython/Includes/cpython/contextvars.pxd +145 -0
  123. Cython/Includes/cpython/conversion.pxd +36 -0
  124. Cython/Includes/cpython/datetime.pxd +395 -0
  125. Cython/Includes/cpython/descr.pxd +26 -0
  126. Cython/Includes/cpython/dict.pxd +187 -0
  127. Cython/Includes/cpython/exc.pxd +263 -0
  128. Cython/Includes/cpython/fileobject.pxd +57 -0
  129. Cython/Includes/cpython/float.pxd +47 -0
  130. Cython/Includes/cpython/function.pxd +65 -0
  131. Cython/Includes/cpython/genobject.pxd +25 -0
  132. Cython/Includes/cpython/getargs.pxd +12 -0
  133. Cython/Includes/cpython/instance.pxd +25 -0
  134. Cython/Includes/cpython/iterator.pxd +36 -0
  135. Cython/Includes/cpython/iterobject.pxd +24 -0
  136. Cython/Includes/cpython/list.pxd +92 -0
  137. Cython/Includes/cpython/long.pxd +149 -0
  138. Cython/Includes/cpython/longintrepr.pxd +14 -0
  139. Cython/Includes/cpython/mapping.pxd +63 -0
  140. Cython/Includes/cpython/marshal.pxd +66 -0
  141. Cython/Includes/cpython/mem.pxd +120 -0
  142. Cython/Includes/cpython/memoryview.pxd +50 -0
  143. Cython/Includes/cpython/method.pxd +49 -0
  144. Cython/Includes/cpython/module.pxd +208 -0
  145. Cython/Includes/cpython/number.pxd +258 -0
  146. Cython/Includes/cpython/object.pxd +433 -0
  147. Cython/Includes/cpython/pycapsule.pxd +143 -0
  148. Cython/Includes/cpython/pylifecycle.pxd +68 -0
  149. Cython/Includes/cpython/pyport.pxd +8 -0
  150. Cython/Includes/cpython/pystate.pxd +95 -0
  151. Cython/Includes/cpython/pythread.pxd +53 -0
  152. Cython/Includes/cpython/ref.pxd +141 -0
  153. Cython/Includes/cpython/sequence.pxd +134 -0
  154. Cython/Includes/cpython/set.pxd +119 -0
  155. Cython/Includes/cpython/slice.pxd +70 -0
  156. Cython/Includes/cpython/time.pxd +129 -0
  157. Cython/Includes/cpython/tuple.pxd +72 -0
  158. Cython/Includes/cpython/type.pxd +53 -0
  159. Cython/Includes/cpython/unicode.pxd +639 -0
  160. Cython/Includes/cpython/version.pxd +32 -0
  161. Cython/Includes/cpython/weakref.pxd +78 -0
  162. Cython/Includes/libc/__init__.pxd +1 -0
  163. Cython/Includes/libc/complex.pxd +35 -0
  164. Cython/Includes/libc/errno.pxd +127 -0
  165. Cython/Includes/libc/float.pxd +43 -0
  166. Cython/Includes/libc/limits.pxd +28 -0
  167. Cython/Includes/libc/locale.pxd +46 -0
  168. Cython/Includes/libc/math.pxd +209 -0
  169. Cython/Includes/libc/setjmp.pxd +10 -0
  170. Cython/Includes/libc/signal.pxd +64 -0
  171. Cython/Includes/libc/stddef.pxd +9 -0
  172. Cython/Includes/libc/stdint.pxd +105 -0
  173. Cython/Includes/libc/stdio.pxd +80 -0
  174. Cython/Includes/libc/stdlib.pxd +72 -0
  175. Cython/Includes/libc/string.pxd +50 -0
  176. Cython/Includes/libc/threads.pxd +234 -0
  177. Cython/Includes/libc/time.pxd +52 -0
  178. Cython/Includes/libcpp/__init__.pxd +4 -0
  179. Cython/Includes/libcpp/algorithm.pxd +320 -0
  180. Cython/Includes/libcpp/any.pxd +16 -0
  181. Cython/Includes/libcpp/atomic.pxd +59 -0
  182. Cython/Includes/libcpp/barrier.pxd +22 -0
  183. Cython/Includes/libcpp/bit.pxd +29 -0
  184. Cython/Includes/libcpp/cast.pxd +12 -0
  185. Cython/Includes/libcpp/cmath.pxd +518 -0
  186. Cython/Includes/libcpp/complex.pxd +106 -0
  187. Cython/Includes/libcpp/condition_variable.pxd +322 -0
  188. Cython/Includes/libcpp/deque.pxd +165 -0
  189. Cython/Includes/libcpp/exception.pxd +86 -0
  190. Cython/Includes/libcpp/execution.pxd +15 -0
  191. Cython/Includes/libcpp/forward_list.pxd +63 -0
  192. Cython/Includes/libcpp/functional.pxd +26 -0
  193. Cython/Includes/libcpp/future.pxd +103 -0
  194. Cython/Includes/libcpp/iterator.pxd +34 -0
  195. Cython/Includes/libcpp/latch.pxd +17 -0
  196. Cython/Includes/libcpp/limits.pxd +61 -0
  197. Cython/Includes/libcpp/list.pxd +117 -0
  198. Cython/Includes/libcpp/map.pxd +252 -0
  199. Cython/Includes/libcpp/memory.pxd +115 -0
  200. Cython/Includes/libcpp/mutex.pxd +387 -0
  201. Cython/Includes/libcpp/numbers.pxd +15 -0
  202. Cython/Includes/libcpp/numeric.pxd +131 -0
  203. Cython/Includes/libcpp/optional.pxd +34 -0
  204. Cython/Includes/libcpp/pair.pxd +1 -0
  205. Cython/Includes/libcpp/queue.pxd +25 -0
  206. Cython/Includes/libcpp/random.pxd +166 -0
  207. Cython/Includes/libcpp/semaphore.pxd +43 -0
  208. Cython/Includes/libcpp/set.pxd +228 -0
  209. Cython/Includes/libcpp/shared_mutex.pxd +96 -0
  210. Cython/Includes/libcpp/span.pxd +87 -0
  211. Cython/Includes/libcpp/stack.pxd +11 -0
  212. Cython/Includes/libcpp/stop_token.pxd +117 -0
  213. Cython/Includes/libcpp/string.pxd +355 -0
  214. Cython/Includes/libcpp/string_view.pxd +183 -0
  215. Cython/Includes/libcpp/typeindex.pxd +15 -0
  216. Cython/Includes/libcpp/typeinfo.pxd +10 -0
  217. Cython/Includes/libcpp/unordered_map.pxd +193 -0
  218. Cython/Includes/libcpp/unordered_set.pxd +152 -0
  219. Cython/Includes/libcpp/utility.pxd +30 -0
  220. Cython/Includes/libcpp/vector.pxd +186 -0
  221. Cython/Includes/numpy/math.pxd +150 -0
  222. Cython/Includes/openmp.pxd +50 -0
  223. Cython/Includes/posix/__init__.pxd +1 -0
  224. Cython/Includes/posix/dlfcn.pxd +14 -0
  225. Cython/Includes/posix/fcntl.pxd +86 -0
  226. Cython/Includes/posix/ioctl.pxd +4 -0
  227. Cython/Includes/posix/mman.pxd +101 -0
  228. Cython/Includes/posix/resource.pxd +57 -0
  229. Cython/Includes/posix/select.pxd +21 -0
  230. Cython/Includes/posix/signal.pxd +73 -0
  231. Cython/Includes/posix/stat.pxd +98 -0
  232. Cython/Includes/posix/stdio.pxd +37 -0
  233. Cython/Includes/posix/stdlib.pxd +29 -0
  234. Cython/Includes/posix/strings.pxd +9 -0
  235. Cython/Includes/posix/time.pxd +71 -0
  236. Cython/Includes/posix/types.pxd +30 -0
  237. Cython/Includes/posix/uio.pxd +26 -0
  238. Cython/Includes/posix/unistd.pxd +271 -0
  239. Cython/Includes/posix/wait.pxd +38 -0
  240. Cython/Plex/Actions.pxd +24 -0
  241. Cython/Plex/Actions.py +119 -0
  242. Cython/Plex/Actions.pyd +0 -0
  243. Cython/Plex/DFA.pxd +14 -0
  244. Cython/Plex/DFA.py +164 -0
  245. Cython/Plex/DFA.pyd +0 -0
  246. Cython/Plex/Errors.py +48 -0
  247. Cython/Plex/Lexicons.py +178 -0
  248. Cython/Plex/Machines.pxd +36 -0
  249. Cython/Plex/Machines.py +238 -0
  250. Cython/Plex/Machines.pyd +0 -0
  251. Cython/Plex/Regexps.py +535 -0
  252. Cython/Plex/Scanners.pxd +45 -0
  253. Cython/Plex/Scanners.py +328 -0
  254. Cython/Plex/Scanners.pyd +0 -0
  255. Cython/Plex/Transitions.pxd +14 -0
  256. Cython/Plex/Transitions.py +239 -0
  257. Cython/Plex/Transitions.pyd +0 -0
  258. Cython/Plex/__init__.py +34 -0
  259. Cython/Runtime/__init__.py +1 -0
  260. Cython/Runtime/refnanny.pyd +0 -0
  261. Cython/Runtime/refnanny.pyx +237 -0
  262. Cython/Shadow.py +690 -0
  263. Cython/Shadow.pyi +521 -0
  264. Cython/StringIOTree.py +170 -0
  265. Cython/StringIOTree.pyd +0 -0
  266. Cython/Tempita/__init__.py +4 -0
  267. Cython/Tempita/_looper.py +154 -0
  268. Cython/Tempita/_tempita.py +1091 -0
  269. Cython/Tempita/_tempita.pyd +0 -0
  270. Cython/TestUtils.py +422 -0
  271. Cython/Tests/TestCodeWriter.py +128 -0
  272. Cython/Tests/TestCythonUtils.py +202 -0
  273. Cython/Tests/TestJediTyper.py +223 -0
  274. Cython/Tests/TestShadow.py +114 -0
  275. Cython/Tests/TestStringIOTree.py +67 -0
  276. Cython/Tests/TestTestUtils.py +90 -0
  277. Cython/Tests/__init__.py +1 -0
  278. Cython/Tests/xmlrunner.py +390 -0
  279. Cython/Utility/AsyncGen.c +1031 -0
  280. Cython/Utility/Buffer.c +865 -0
  281. Cython/Utility/BufferFormatFromTypeInfo.pxd +2 -0
  282. Cython/Utility/Builtins.c +810 -0
  283. Cython/Utility/CConvert.pyx +134 -0
  284. Cython/Utility/CMath.c +104 -0
  285. Cython/Utility/CommonStructures.c +226 -0
  286. Cython/Utility/Complex.c +378 -0
  287. Cython/Utility/Coroutine.c +2300 -0
  288. Cython/Utility/CpdefEnums.pyx +103 -0
  289. Cython/Utility/CppConvert.pyx +282 -0
  290. Cython/Utility/CppSupport.cpp +151 -0
  291. Cython/Utility/CythonFunction.c +1832 -0
  292. Cython/Utility/Dataclasses.c +101 -0
  293. Cython/Utility/Embed.c +121 -0
  294. Cython/Utility/Exceptions.c +1016 -0
  295. Cython/Utility/ExtensionTypes.c +996 -0
  296. Cython/Utility/FunctionArguments.c +1043 -0
  297. Cython/Utility/FusedFunction.pyx +44 -0
  298. Cython/Utility/ImportExport.c +907 -0
  299. Cython/Utility/MemoryView.pxd +188 -0
  300. Cython/Utility/MemoryView.pyx +1482 -0
  301. Cython/Utility/MemoryView_C.c +927 -0
  302. Cython/Utility/ModuleSetupCode.c +3203 -0
  303. Cython/Utility/NumpyImportArray.c +46 -0
  304. Cython/Utility/ObjectHandling.c +3273 -0
  305. Cython/Utility/Optimize.c +1603 -0
  306. Cython/Utility/Overflow.c +384 -0
  307. Cython/Utility/Printing.c +86 -0
  308. Cython/Utility/Profile.c +732 -0
  309. Cython/Utility/StringTools.c +1379 -0
  310. Cython/Utility/Synchronization.c +399 -0
  311. Cython/Utility/TString.c +356 -0
  312. Cython/Utility/TestCyUtilityLoader.pyx +8 -0
  313. Cython/Utility/TestCythonScope.pyx +75 -0
  314. Cython/Utility/TestUtilityLoader.c +12 -0
  315. Cython/Utility/TypeConversion.c +1385 -0
  316. Cython/Utility/UFuncs.pyx +50 -0
  317. Cython/Utility/UFuncs_C.c +89 -0
  318. Cython/Utility/__init__.py +28 -0
  319. Cython/Utility/arrayarray.h +167 -0
  320. Cython/Utils.py +687 -0
  321. Cython/Utils.pyd +0 -0
  322. Cython/__init__.py +10 -0
  323. Cython/__init__.pyi +7 -0
  324. Cython/py.typed +0 -0
  325. cython-3.2.0.dist-info/METADATA +85 -0
  326. cython-3.2.0.dist-info/RECORD +333 -0
  327. cython-3.2.0.dist-info/WHEEL +5 -0
  328. cython-3.2.0.dist-info/entry_points.txt +4 -0
  329. cython-3.2.0.dist-info/top_level.txt +3 -0
  330. cython.py +29 -0
  331. pyximport/__init__.py +4 -0
  332. pyximport/pyxbuild.py +160 -0
  333. pyximport/pyximport.py +482 -0
@@ -0,0 +1,1832 @@
1
+ //////////////////// CythonFunctionShared.module_state_decls ////////////////////
2
+
3
+ PyTypeObject *__pyx_CyFunctionType;
4
+
5
+ //////////////////// CythonFunctionShared.module_state_traverse ///////////////////
6
+
7
+ Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
8
+
9
+ //////////////////// CythonFunctionShared.module_state_clear ///////////////////
10
+
11
+ Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
12
+
13
+ //////////////////// CythonFunctionShared.init //////////////////
14
+ //@substitute: naming
15
+
16
+ if (likely(__pyx_CyFunction_init($module_cname) == 0)); else
17
+
18
+ //////////////////// CythonFunctionShared.proto ////////////////////
19
+
20
+ #define __Pyx_CyFunction_USED
21
+
22
+ #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
23
+ #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
24
+ #define __Pyx_CYFUNCTION_CCLASS 0x04
25
+ #define __Pyx_CYFUNCTION_COROUTINE 0x08
26
+
27
+ #define __Pyx_CyFunction_GetClosure(f) \
28
+ (((__pyx_CyFunctionObject *) (f))->func_closure)
29
+
30
+ #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
31
+ #define __Pyx_CyFunction_GetClassObj(f) \
32
+ (((__pyx_CyFunctionObject *) (f))->func_classobj)
33
+ #else
34
+ #define __Pyx_CyFunction_GetClassObj(f) \
35
+ ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
36
+ #endif
37
+ #define __Pyx_CyFunction_SetClassObj(f, classobj) \
38
+ __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
39
+
40
+ #define __Pyx_CyFunction_Defaults(type, f) \
41
+ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
42
+ #define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
43
+ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
44
+
45
+
46
+ typedef struct {
47
+ #if CYTHON_COMPILING_IN_LIMITED_API
48
+ PyObject_HEAD
49
+ // We can't "inherit" from func, but we can use it as a data store
50
+ PyObject *func;
51
+ #elif PY_VERSION_HEX < 0x030900B1
52
+ PyCFunctionObject func;
53
+ #else
54
+ // PEP-573: PyCFunctionObject + mm_class
55
+ PyCMethodObject func;
56
+ #endif
57
+ #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
58
+ __pyx_vectorcallfunc func_vectorcall;
59
+ #endif
60
+ #if CYTHON_COMPILING_IN_LIMITED_API
61
+ PyObject *func_weakreflist;
62
+ #endif
63
+ #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
64
+ PyObject *func_dict;
65
+ #endif
66
+ PyObject *func_name;
67
+ PyObject *func_qualname;
68
+ PyObject *func_doc;
69
+ PyObject *func_globals;
70
+ PyObject *func_code;
71
+ PyObject *func_closure;
72
+ #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
73
+ // No-args super() class cell
74
+ PyObject *func_classobj;
75
+ #endif
76
+ // Dynamic default args and annotations
77
+ PyObject *defaults;
78
+ int flags;
79
+
80
+ // Defaults info
81
+ PyObject *defaults_tuple; /* Const defaults tuple */
82
+ PyObject *defaults_kwdict; /* Const kwonly defaults dict */
83
+ PyObject *(*defaults_getter)(PyObject *);
84
+ PyObject *func_annotations; /* function annotations dict */
85
+
86
+ // Coroutine marker
87
+ PyObject *func_is_coroutine;
88
+ } __pyx_CyFunctionObject;
89
+
90
+ #undef __Pyx_CyOrPyCFunction_Check
91
+ #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, CGLOBAL(__pyx_CyFunctionType))
92
+ #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, CGLOBAL(__pyx_CyFunctionType), &PyCFunction_Type)
93
+ #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, CGLOBAL(__pyx_CyFunctionType))
94
+ static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));/*proto*/
95
+ #undef __Pyx_IsSameCFunction
96
+ #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
97
+
98
+ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
99
+ int flags, PyObject* qualname,
100
+ PyObject *closure,
101
+ PyObject *module, PyObject *globals,
102
+ PyObject* code);
103
+
104
+ static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
105
+ static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
106
+ PyTypeObject *defaults_type);
107
+ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
108
+ PyObject *tuple);
109
+ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
110
+ PyObject *dict);
111
+ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
112
+ PyObject *dict);
113
+
114
+
115
+ static int __pyx_CyFunction_init(PyObject *module);
116
+
117
+ #if CYTHON_METH_FASTCALL
118
+ static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
119
+ static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
120
+ static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
121
+ static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
122
+ #if CYTHON_COMPILING_IN_LIMITED_API
123
+ #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
124
+ #else
125
+ #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
126
+ #endif
127
+ #endif
128
+
129
+ //////////////////// CythonFunctionShared ////////////////////
130
+ //@requires: CommonStructures.c::FetchCommonType
131
+ //@requires: CommonStructures.c::CommonTypesMetaclass
132
+ //@requires: ObjectHandling.c::PyMethodNew
133
+ //@requires: ObjectHandling.c::PyVectorcallFastCallDict
134
+ //@requires: ModuleSetupCode.c::IncludeStructmemberH
135
+ //@requires: ObjectHandling.c::PyObjectGetAttrStr
136
+ //@requires: ObjectHandling.c::CachedMethodType
137
+ //@requires: ExtensionTypes.c::CallTypeTraverse
138
+ //@requires: Synchronization.c::CriticalSections
139
+ //@substitute: naming
140
+
141
+ #if CYTHON_COMPILING_IN_LIMITED_API
142
+ static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
143
+ if (__Pyx_CyFunction_Check(func)) {
144
+ return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
145
+ } else if (PyCFunction_Check(func)) {
146
+ return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
147
+ }
148
+ return 0;
149
+ }
150
+
151
+ static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
152
+ if ((PyObject*)Py_TYPE(func) == CGLOBAL(__Pyx_CachedMethodType)) {
153
+ int result;
154
+ PyObject *newFunc = PyObject_GetAttr(func, PYIDENT("__func__"));
155
+ if (unlikely(!newFunc)) {
156
+ PyErr_Clear(); // It's only an optimization, so don't throw an error
157
+ return 0;
158
+ }
159
+ result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
160
+ Py_DECREF(newFunc);
161
+ return result;
162
+ }
163
+ return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
164
+ }
165
+ #else
166
+ static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
167
+ if (PyMethod_Check(func)) {
168
+ func = PyMethod_GET_FUNCTION(func);
169
+ }
170
+ return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
171
+ }
172
+ #endif
173
+
174
+ static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
175
+ #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
176
+ __Pyx_Py_XDECREF_SET(
177
+ __Pyx_CyFunction_GetClassObj(f),
178
+ ((classobj) ? __Pyx_NewRef(classobj) : NULL));
179
+ #else
180
+ __Pyx_Py_XDECREF_SET(
181
+ // assigning to "mm_class", which is a "PyTypeObject*"
182
+ ((PyCMethodObject *) (f))->mm_class,
183
+ (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
184
+ #endif
185
+ }
186
+
187
+ static PyObject *
188
+ __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
189
+ {
190
+ if (unlikely(op->func_doc == NULL)) {
191
+ #if CYTHON_COMPILING_IN_LIMITED_API
192
+ op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
193
+ if (unlikely(!op->func_doc)) return NULL;
194
+ #else
195
+ if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
196
+ op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
197
+ if (unlikely(op->func_doc == NULL))
198
+ return NULL;
199
+ } else {
200
+ Py_INCREF(Py_None);
201
+ return Py_None;
202
+ }
203
+ #endif /* CYTHON_COMPILING_IN_LIMITED_API */
204
+ }
205
+ Py_INCREF(op->func_doc);
206
+ return op->func_doc;
207
+ }
208
+
209
+ static PyObject *
210
+ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
211
+ PyObject *result;
212
+ CYTHON_UNUSED_VAR(closure);
213
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
214
+ result = __Pyx_CyFunction_get_doc_locked(op);
215
+ __Pyx_END_CRITICAL_SECTION();
216
+ return result;
217
+ }
218
+
219
+ static int
220
+ __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
221
+ {
222
+ CYTHON_UNUSED_VAR(context);
223
+ if (value == NULL) {
224
+ // Mark as deleted
225
+ value = Py_None;
226
+ }
227
+ Py_INCREF(value);
228
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
229
+ __Pyx_Py_XDECREF_SET(op->func_doc, value);
230
+ __Pyx_END_CRITICAL_SECTION();
231
+ return 0;
232
+ }
233
+
234
+ static PyObject *
235
+ __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
236
+ {
237
+ if (unlikely(op->func_name == NULL)) {
238
+ #if CYTHON_COMPILING_IN_LIMITED_API
239
+ op->func_name = PyObject_GetAttrString(op->func, "__name__");
240
+ #else
241
+ op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
242
+ #endif /* CYTHON_COMPILING_IN_LIMITED_API */
243
+ if (unlikely(op->func_name == NULL))
244
+ return NULL;
245
+ }
246
+ Py_INCREF(op->func_name);
247
+ return op->func_name;
248
+ }
249
+
250
+ static PyObject *
251
+ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
252
+ {
253
+ PyObject *result = NULL;
254
+ CYTHON_UNUSED_VAR(context);
255
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
256
+ result = __Pyx_CyFunction_get_name_locked(op);
257
+ __Pyx_END_CRITICAL_SECTION();
258
+ return result;
259
+ }
260
+
261
+ static int
262
+ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
263
+ {
264
+ CYTHON_UNUSED_VAR(context);
265
+ if (unlikely(value == NULL || !PyUnicode_Check(value))) {
266
+ PyErr_SetString(PyExc_TypeError,
267
+ "__name__ must be set to a string object");
268
+ return -1;
269
+ }
270
+ Py_INCREF(value);
271
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
272
+ __Pyx_Py_XDECREF_SET(op->func_name, value);
273
+ __Pyx_END_CRITICAL_SECTION();
274
+ return 0;
275
+ }
276
+
277
+ static PyObject *
278
+ __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
279
+ {
280
+ CYTHON_UNUSED_VAR(context);
281
+ PyObject *result;
282
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
283
+ Py_INCREF(op->func_qualname);
284
+ result = op->func_qualname;
285
+ __Pyx_END_CRITICAL_SECTION();
286
+ return result;
287
+ }
288
+
289
+ static int
290
+ __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
291
+ {
292
+ CYTHON_UNUSED_VAR(context);
293
+ if (unlikely(value == NULL || !PyUnicode_Check(value))) {
294
+ PyErr_SetString(PyExc_TypeError,
295
+ "__qualname__ must be set to a string object");
296
+ return -1;
297
+ }
298
+ Py_INCREF(value);
299
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
300
+ __Pyx_Py_XDECREF_SET(op->func_qualname, value);
301
+ __Pyx_END_CRITICAL_SECTION();
302
+ return 0;
303
+ }
304
+
305
+ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
306
+ static PyObject *
307
+ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
308
+ {
309
+ CYTHON_UNUSED_VAR(context);
310
+ // PyObject_GenericGetDict is not defined
311
+ if (unlikely(op->func_dict == NULL)) {
312
+ op->func_dict = PyDict_New();
313
+ if (unlikely(op->func_dict == NULL))
314
+ return NULL;
315
+ }
316
+ Py_INCREF(op->func_dict);
317
+ return op->func_dict;
318
+ }
319
+ #endif
320
+
321
+ static PyObject *
322
+ __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
323
+ {
324
+ CYTHON_UNUSED_VAR(context);
325
+ // Globals is read-only so no critical sections
326
+ Py_INCREF(op->func_globals);
327
+ return op->func_globals;
328
+ }
329
+
330
+ static PyObject *
331
+ __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
332
+ {
333
+ CYTHON_UNUSED_VAR(op);
334
+ CYTHON_UNUSED_VAR(context);
335
+ Py_INCREF(Py_None);
336
+ return Py_None;
337
+ }
338
+
339
+ static PyObject *
340
+ __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
341
+ {
342
+ // code is read-only so no critical sections
343
+ PyObject* result = (op->func_code) ? op->func_code : Py_None;
344
+ CYTHON_UNUSED_VAR(context);
345
+ Py_INCREF(result);
346
+ return result;
347
+ }
348
+
349
+ static int
350
+ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
351
+ int result = 0;
352
+ PyObject *res = op->defaults_getter((PyObject *) op);
353
+ if (unlikely(!res))
354
+ return -1;
355
+
356
+ // Cache result
357
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
358
+ op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
359
+ Py_INCREF(op->defaults_tuple);
360
+ op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
361
+ Py_INCREF(op->defaults_kwdict);
362
+ #else
363
+ op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
364
+ if (unlikely(!op->defaults_tuple)) result = -1;
365
+ else {
366
+ op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
367
+ if (unlikely(!op->defaults_kwdict)) result = -1;
368
+ }
369
+ #endif
370
+ Py_DECREF(res);
371
+ return result;
372
+ }
373
+
374
+ static int
375
+ __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
376
+ CYTHON_UNUSED_VAR(context);
377
+ if (!value) {
378
+ // del => explicit None to prevent rebuilding
379
+ value = Py_None;
380
+ } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
381
+ PyErr_SetString(PyExc_TypeError,
382
+ "__defaults__ must be set to a tuple object");
383
+ return -1;
384
+ }
385
+ PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
386
+ "currently affect the values used in function calls", 1);
387
+ Py_INCREF(value);
388
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
389
+ __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
390
+ __Pyx_END_CRITICAL_SECTION();
391
+ return 0;
392
+ }
393
+
394
+ static PyObject *
395
+ __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
396
+ PyObject* result = op->defaults_tuple;
397
+ if (unlikely(!result)) {
398
+ if (op->defaults_getter) {
399
+ if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
400
+ result = op->defaults_tuple;
401
+ } else {
402
+ result = Py_None;
403
+ }
404
+ }
405
+ Py_INCREF(result);
406
+ return result;
407
+ }
408
+
409
+ static PyObject *
410
+ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
411
+ PyObject* result = NULL;
412
+ CYTHON_UNUSED_VAR(context);
413
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
414
+ result = __Pyx_CyFunction_get_defaults_locked(op);
415
+ __Pyx_END_CRITICAL_SECTION();
416
+ return result;
417
+ }
418
+
419
+ static int
420
+ __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
421
+ CYTHON_UNUSED_VAR(context);
422
+ if (!value) {
423
+ // del => explicit None to prevent rebuilding
424
+ value = Py_None;
425
+ } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
426
+ PyErr_SetString(PyExc_TypeError,
427
+ "__kwdefaults__ must be set to a dict object");
428
+ return -1;
429
+ }
430
+ PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
431
+ "currently affect the values used in function calls", 1);
432
+ Py_INCREF(value);
433
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
434
+ __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
435
+ __Pyx_END_CRITICAL_SECTION();
436
+ return 0;
437
+ }
438
+
439
+ static PyObject *
440
+ __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
441
+ PyObject* result = op->defaults_kwdict;
442
+ if (unlikely(!result)) {
443
+ if (op->defaults_getter) {
444
+ if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
445
+ result = op->defaults_kwdict;
446
+ } else {
447
+ result = Py_None;
448
+ }
449
+ }
450
+ Py_INCREF(result);
451
+ return result;
452
+ }
453
+
454
+ static PyObject *
455
+ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
456
+ PyObject* result;
457
+ CYTHON_UNUSED_VAR(context);
458
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
459
+ result = __Pyx_CyFunction_get_kwdefaults_locked(op);
460
+ __Pyx_END_CRITICAL_SECTION();
461
+ return result;
462
+ }
463
+
464
+ static int
465
+ __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
466
+ CYTHON_UNUSED_VAR(context);
467
+ if (!value || value == Py_None) {
468
+ value = NULL;
469
+ } else if (unlikely(!PyDict_Check(value))) {
470
+ PyErr_SetString(PyExc_TypeError,
471
+ "__annotations__ must be set to a dict object");
472
+ return -1;
473
+ }
474
+ Py_XINCREF(value);
475
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
476
+ __Pyx_Py_XDECREF_SET(op->func_annotations, value);
477
+ __Pyx_END_CRITICAL_SECTION();
478
+ return 0;
479
+ }
480
+
481
+ static PyObject *
482
+ __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
483
+ PyObject* result = op->func_annotations;
484
+ if (unlikely(!result)) {
485
+ result = PyDict_New();
486
+ if (unlikely(!result)) return NULL;
487
+ op->func_annotations = result;
488
+ }
489
+ Py_INCREF(result);
490
+ return result;
491
+ }
492
+
493
+ static PyObject *
494
+ __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
495
+ PyObject *result;
496
+ CYTHON_UNUSED_VAR(context);
497
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
498
+ result = __Pyx_CyFunction_get_annotations_locked(op);
499
+ __Pyx_END_CRITICAL_SECTION();
500
+ return result;
501
+ }
502
+
503
+ static PyObject *
504
+ __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
505
+ int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
506
+ if (is_coroutine) {
507
+ PyObject *is_coroutine_value, *module, *fromlist, *marker = PYIDENT("_is_coroutine");
508
+ fromlist = PyList_New(1);
509
+ if (unlikely(!fromlist)) return NULL;
510
+ Py_INCREF(marker);
511
+ #if CYTHON_ASSUME_SAFE_MACROS
512
+ PyList_SET_ITEM(fromlist, 0, marker);
513
+ #else
514
+ if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
515
+ Py_DECREF(marker);
516
+ Py_DECREF(fromlist);
517
+ return NULL;
518
+ }
519
+ #endif
520
+ module = PyImport_ImportModuleLevelObject(PYIDENT("asyncio.coroutines"), NULL, NULL, fromlist, 0);
521
+ Py_DECREF(fromlist);
522
+ if (unlikely(!module)) goto ignore;
523
+ is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
524
+ Py_DECREF(module);
525
+ if (likely(is_coroutine_value)) {
526
+ return is_coroutine_value;
527
+ }
528
+ ignore:
529
+ PyErr_Clear();
530
+ }
531
+
532
+ return __Pyx_PyBool_FromLong(is_coroutine);
533
+ }
534
+
535
+ static PyObject *
536
+ __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
537
+ PyObject *result;
538
+ CYTHON_UNUSED_VAR(context);
539
+ if (op->func_is_coroutine) {
540
+ return __Pyx_NewRef(op->func_is_coroutine);
541
+ }
542
+
543
+ result = __Pyx_CyFunction_get_is_coroutine_value(op);
544
+ if (unlikely(!result))
545
+ return NULL;
546
+
547
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
548
+ // Guard against concurrent initialisation.
549
+ if (op->func_is_coroutine) {
550
+ Py_DECREF(result);
551
+ result = __Pyx_NewRef(op->func_is_coroutine);
552
+ } else {
553
+ op->func_is_coroutine = __Pyx_NewRef(result);
554
+ }
555
+ __Pyx_END_CRITICAL_SECTION();
556
+ return result;
557
+ }
558
+
559
+ //static PyObject *
560
+ //__Pyx_CyFunction_get_signature(__pyx_CyFunctionObject *op, void *context) {
561
+ // PyObject *inspect_module, *signature_class, *signature;
562
+ // CYTHON_UNUSED_VAR(context);
563
+ // // from inspect import Signature
564
+ // inspect_module = PyImport_ImportModuleLevelObject(PYIDENT("inspect"), NULL, NULL, NULL, 0);
565
+ // if (unlikely(!inspect_module))
566
+ // goto bad;
567
+ // signature_class = __Pyx_PyObject_GetAttrStr(inspect_module, PYIDENT("Signature"));
568
+ // Py_DECREF(inspect_module);
569
+ // if (unlikely(!signature_class))
570
+ // goto bad;
571
+ // // return Signature.from_function(op)
572
+ // signature = PyObject_CallMethodObjArgs(signature_class, PYIDENT("from_function"), op, NULL);
573
+ // Py_DECREF(signature_class);
574
+ // if (likely(signature))
575
+ // return signature;
576
+ //bad:
577
+ // // make sure we raise an AttributeError from this property on any errors
578
+ // if (!PyErr_ExceptionMatches(PyExc_AttributeError))
579
+ // PyErr_SetString(PyExc_AttributeError, "failed to calculate __signature__");
580
+ // return NULL;
581
+ //}
582
+
583
+ static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
584
+ #if CYTHON_COMPILING_IN_LIMITED_API
585
+ PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
586
+ if (!py_name) return;
587
+ PyErr_Format(PyExc_TypeError,
588
+ "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
589
+ py_name, message, size);
590
+ Py_DECREF(py_name);
591
+ #else
592
+ const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
593
+ PyErr_Format(PyExc_TypeError,
594
+ "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
595
+ name, message, size);
596
+ #endif
597
+ }
598
+
599
+ static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
600
+ #if CYTHON_COMPILING_IN_LIMITED_API
601
+ PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
602
+ if (!py_name) return;
603
+ PyErr_Format(PyExc_TypeError,
604
+ "%.200S() %s",
605
+ py_name, message);
606
+ Py_DECREF(py_name);
607
+ #else
608
+ const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
609
+ PyErr_Format(PyExc_TypeError,
610
+ "%.200s() %s",
611
+ name, message);
612
+ #endif
613
+ }
614
+
615
+
616
+ #if CYTHON_COMPILING_IN_LIMITED_API
617
+ static PyObject *
618
+ __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
619
+ CYTHON_UNUSED_VAR(context);
620
+ return PyObject_GetAttrString(op->func, "__module__");
621
+ }
622
+
623
+ static int
624
+ __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
625
+ CYTHON_UNUSED_VAR(context);
626
+ return PyObject_SetAttrString(op->func, "__module__", value);
627
+ }
628
+ #endif
629
+
630
+ static PyGetSetDef __pyx_CyFunction_getsets[] = {
631
+ {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
632
+ {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
633
+ {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
634
+ {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
635
+ {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
636
+ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
637
+ {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
638
+ {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
639
+ #else
640
+ {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
641
+ {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
642
+ #endif
643
+ {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
644
+ {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
645
+ {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
646
+ {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
647
+ {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
648
+ {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
649
+ {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
650
+ {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
651
+ {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
652
+ {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
653
+ {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
654
+ // {"__signature__", (getter)__Pyx_CyFunction_get_signature, 0, 0, 0},
655
+ #if CYTHON_COMPILING_IN_LIMITED_API
656
+ {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
657
+ #endif
658
+ {0, 0, 0, 0, 0}
659
+ };
660
+
661
+ static PyMemberDef __pyx_CyFunction_members[] = {
662
+ #if !CYTHON_COMPILING_IN_LIMITED_API
663
+ {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
664
+ #endif
665
+ #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
666
+ {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
667
+ #endif
668
+ #if CYTHON_METH_FASTCALL
669
+ #if CYTHON_COMPILING_IN_LIMITED_API
670
+ {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
671
+ #else
672
+ {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
673
+ #endif
674
+ #if CYTHON_COMPILING_IN_LIMITED_API
675
+ {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
676
+ #else
677
+ {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
678
+ #endif
679
+ #endif
680
+ {0, 0, 0, 0, 0}
681
+ };
682
+
683
+ static PyObject *
684
+ __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
685
+ {
686
+ PyObject *result = NULL;
687
+ CYTHON_UNUSED_VAR(args);
688
+ __Pyx_BEGIN_CRITICAL_SECTION(m);
689
+ Py_INCREF(m->func_qualname);
690
+ result = m->func_qualname;
691
+ __Pyx_END_CRITICAL_SECTION();
692
+ return result;
693
+ }
694
+
695
+ static PyMethodDef __pyx_CyFunction_methods[] = {
696
+ {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
697
+ {0, 0, 0, 0}
698
+ };
699
+
700
+
701
+ #if CYTHON_COMPILING_IN_LIMITED_API
702
+ #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
703
+ #else
704
+ #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
705
+ #endif
706
+
707
+ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
708
+ PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
709
+ #if !CYTHON_COMPILING_IN_LIMITED_API
710
+ PyCFunctionObject *cf = (PyCFunctionObject*) op;
711
+ #endif
712
+ if (unlikely(op == NULL))
713
+ return NULL;
714
+ #if CYTHON_COMPILING_IN_LIMITED_API
715
+ // Note that we end up with a circular reference to op. This isn't
716
+ // a disaster, but in an ideal world it'd be nice to avoid it.
717
+ op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
718
+ if (unlikely(!op->func)) return NULL;
719
+ #endif
720
+ op->flags = flags;
721
+ __Pyx_CyFunction_weakreflist(op) = NULL;
722
+ #if !CYTHON_COMPILING_IN_LIMITED_API
723
+ cf->m_ml = ml;
724
+ cf->m_self = (PyObject *) op;
725
+ #endif
726
+ Py_XINCREF(closure);
727
+ op->func_closure = closure;
728
+ #if !CYTHON_COMPILING_IN_LIMITED_API
729
+ Py_XINCREF(module);
730
+ cf->m_module = module;
731
+ #endif
732
+ #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
733
+ op->func_dict = NULL;
734
+ #endif
735
+ op->func_name = NULL;
736
+ Py_INCREF(qualname);
737
+ op->func_qualname = qualname;
738
+ op->func_doc = NULL;
739
+ #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
740
+ op->func_classobj = NULL;
741
+ #else
742
+ ((PyCMethodObject*)op)->mm_class = NULL;
743
+ #endif
744
+ op->func_globals = globals;
745
+ Py_INCREF(op->func_globals);
746
+ Py_XINCREF(code);
747
+ op->func_code = code;
748
+ // Dynamic Default args
749
+ op->defaults = NULL;
750
+ op->defaults_tuple = NULL;
751
+ op->defaults_kwdict = NULL;
752
+ op->defaults_getter = NULL;
753
+ op->func_annotations = NULL;
754
+ op->func_is_coroutine = NULL;
755
+ #if CYTHON_METH_FASTCALL
756
+ switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
757
+ case METH_NOARGS:
758
+ __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
759
+ break;
760
+ case METH_O:
761
+ __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
762
+ break;
763
+ // case METH_FASTCALL is not used
764
+ case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
765
+ __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
766
+ break;
767
+ case METH_FASTCALL | METH_KEYWORDS:
768
+ __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
769
+ break;
770
+ // case METH_VARARGS is not used
771
+ case METH_VARARGS | METH_KEYWORDS:
772
+ __Pyx_CyFunction_func_vectorcall(op) = NULL;
773
+ break;
774
+ default:
775
+ PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
776
+ Py_DECREF(op);
777
+ return NULL;
778
+ }
779
+ #endif
780
+ return (PyObject *) op;
781
+ }
782
+
783
+ static int
784
+ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
785
+ {
786
+ Py_CLEAR(m->func_closure);
787
+ #if CYTHON_COMPILING_IN_LIMITED_API
788
+ Py_CLEAR(m->func);
789
+ #else
790
+ Py_CLEAR(((PyCFunctionObject*)m)->m_module);
791
+ #endif
792
+ #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
793
+ Py_CLEAR(m->func_dict);
794
+ #elif PY_VERSION_HEX < 0x030d0000
795
+ _PyObject_ClearManagedDict((PyObject*)m);
796
+ #else
797
+ PyObject_ClearManagedDict((PyObject*)m);
798
+ #endif
799
+ Py_CLEAR(m->func_name);
800
+ Py_CLEAR(m->func_qualname);
801
+ Py_CLEAR(m->func_doc);
802
+ Py_CLEAR(m->func_globals);
803
+ Py_CLEAR(m->func_code);
804
+ #if !CYTHON_COMPILING_IN_LIMITED_API
805
+ #if PY_VERSION_HEX < 0x030900B1
806
+ Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
807
+ #else
808
+ {
809
+ PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
810
+ ((PyCMethodObject *) (m))->mm_class = NULL;
811
+ Py_XDECREF(cls);
812
+ }
813
+ #endif
814
+ #endif
815
+ Py_CLEAR(m->defaults_tuple);
816
+ Py_CLEAR(m->defaults_kwdict);
817
+ Py_CLEAR(m->func_annotations);
818
+ Py_CLEAR(m->func_is_coroutine);
819
+
820
+ Py_CLEAR(m->defaults);
821
+
822
+ return 0;
823
+ }
824
+
825
+ static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
826
+ {
827
+ if (__Pyx_CyFunction_weakreflist(m) != NULL)
828
+ PyObject_ClearWeakRefs((PyObject *) m);
829
+ __Pyx_CyFunction_clear(m);
830
+ __Pyx_PyHeapTypeObject_GC_Del(m);
831
+ }
832
+
833
+ static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
834
+ {
835
+ PyObject_GC_UnTrack(m);
836
+ __Pyx__CyFunction_dealloc(m);
837
+ }
838
+
839
+ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
840
+ {
841
+ {
842
+ int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
843
+ if (e) return e;
844
+ }
845
+ Py_VISIT(m->func_closure);
846
+ #if CYTHON_COMPILING_IN_LIMITED_API
847
+ Py_VISIT(m->func);
848
+ #else
849
+ Py_VISIT(((PyCFunctionObject*)m)->m_module);
850
+ #endif
851
+ #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
852
+ Py_VISIT(m->func_dict);
853
+ #else
854
+ {
855
+ int e =
856
+ #if PY_VERSION_HEX < 0x030d0000
857
+ _PyObject_VisitManagedDict
858
+ #else
859
+ PyObject_VisitManagedDict
860
+ #endif
861
+ ((PyObject*)m, visit, arg);
862
+ if (e != 0) return e;
863
+ }
864
+ #endif
865
+ __Pyx_VISIT_CONST(m->func_name);
866
+ __Pyx_VISIT_CONST(m->func_qualname);
867
+ Py_VISIT(m->func_doc);
868
+ Py_VISIT(m->func_globals);
869
+ // The code objects that we generate only contain plain constants and can never participate in reference cycles.
870
+ __Pyx_VISIT_CONST(m->func_code);
871
+ #if !CYTHON_COMPILING_IN_LIMITED_API
872
+ Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
873
+ #endif
874
+ Py_VISIT(m->defaults_tuple);
875
+ Py_VISIT(m->defaults_kwdict);
876
+ Py_VISIT(m->func_is_coroutine);
877
+ Py_VISIT(m->defaults);
878
+
879
+ return 0;
880
+ }
881
+
882
+ static PyObject*
883
+ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
884
+ {
885
+ PyObject *repr;
886
+ __Pyx_BEGIN_CRITICAL_SECTION(op);
887
+ repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
888
+ op->func_qualname, (void *)op);
889
+ __Pyx_END_CRITICAL_SECTION();
890
+ return repr;
891
+ }
892
+
893
+ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
894
+ // originally copied from PyCFunction_Call() in CPython's Objects/methodobject.c
895
+ #if CYTHON_COMPILING_IN_LIMITED_API
896
+ PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
897
+ PyCFunction meth;
898
+ int flags;
899
+ meth = PyCFunction_GetFunction(f);
900
+ if (unlikely(!meth)) return NULL;
901
+ flags = PyCFunction_GetFlags(f);
902
+ if (unlikely(flags < 0)) return NULL;
903
+ #else
904
+ PyCFunctionObject* f = (PyCFunctionObject*)func;
905
+ PyCFunction meth = f->m_ml->ml_meth;
906
+ int flags = f->m_ml->ml_flags;
907
+ #endif
908
+ Py_ssize_t size;
909
+
910
+ switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
911
+ case METH_VARARGS:
912
+ if (likely(kw == NULL || PyDict_Size(kw) == 0))
913
+ return (*meth)(self, arg);
914
+ break;
915
+ case METH_VARARGS | METH_KEYWORDS:
916
+ return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
917
+ case METH_NOARGS:
918
+ if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
919
+ #if CYTHON_ASSUME_SAFE_SIZE
920
+ size = PyTuple_GET_SIZE(arg);
921
+ #else
922
+ size = PyTuple_Size(arg);
923
+ if (unlikely(size < 0)) return NULL;
924
+ #endif
925
+ if (likely(size == 0))
926
+ return (*meth)(self, NULL);
927
+ __Pyx_CyFunction_raise_argument_count_error(
928
+ (__pyx_CyFunctionObject*)func,
929
+ "takes no arguments", size);
930
+ return NULL;
931
+ }
932
+ break;
933
+ case METH_O:
934
+ if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
935
+ #if CYTHON_ASSUME_SAFE_SIZE
936
+ size = PyTuple_GET_SIZE(arg);
937
+ #else
938
+ size = PyTuple_Size(arg);
939
+ if (unlikely(size < 0)) return NULL;
940
+ #endif
941
+ if (likely(size == 1)) {
942
+ PyObject *result, *arg0;
943
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
944
+ arg0 = PyTuple_GET_ITEM(arg, 0);
945
+ #else
946
+ arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
947
+ #endif
948
+ result = (*meth)(self, arg0);
949
+ #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
950
+ Py_DECREF(arg0);
951
+ #endif
952
+ return result;
953
+ }
954
+ __Pyx_CyFunction_raise_argument_count_error(
955
+ (__pyx_CyFunctionObject*)func,
956
+ "takes exactly one argument", size);
957
+ return NULL;
958
+ }
959
+ break;
960
+ default:
961
+ PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
962
+ return NULL;
963
+ }
964
+ __Pyx_CyFunction_raise_type_error(
965
+ (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
966
+ return NULL;
967
+ }
968
+
969
+ static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
970
+ PyObject *self, *result;
971
+ #if CYTHON_COMPILING_IN_LIMITED_API
972
+ // PyCFunction_GetSelf returns a borrowed reference
973
+ self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
974
+ if (unlikely(!self) && PyErr_Occurred()) return NULL;
975
+ #else
976
+ self = ((PyCFunctionObject*)func)->m_self;
977
+ #endif
978
+ result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
979
+ return result;
980
+ }
981
+
982
+ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
983
+ PyObject *result;
984
+ __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
985
+
986
+ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
987
+ // Prefer vectorcall if available. This is not the typical case, as
988
+ // CPython would normally use vectorcall directly instead of tp_call.
989
+ __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
990
+ if (vc) {
991
+ #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
992
+ return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
993
+ #else
994
+ // avoid unused function warning
995
+ (void) &__Pyx_PyVectorcall_FastCallDict;
996
+ return PyVectorcall_Call(func, args, kw);
997
+ #endif
998
+ }
999
+ #endif
1000
+
1001
+ if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
1002
+ Py_ssize_t argc;
1003
+ PyObject *new_args;
1004
+ PyObject *self;
1005
+
1006
+ #if CYTHON_ASSUME_SAFE_SIZE
1007
+ argc = PyTuple_GET_SIZE(args);
1008
+ #else
1009
+ argc = PyTuple_Size(args);
1010
+ if (unlikely(argc < 0)) return NULL;
1011
+ #endif
1012
+ new_args = PyTuple_GetSlice(args, 1, argc);
1013
+
1014
+ if (unlikely(!new_args))
1015
+ return NULL;
1016
+
1017
+ self = PyTuple_GetItem(args, 0);
1018
+ if (unlikely(!self)) {
1019
+ Py_DECREF(new_args);
1020
+ PyErr_Format(PyExc_TypeError,
1021
+ "unbound method %.200S() needs an argument",
1022
+ cyfunc->func_qualname);
1023
+ return NULL;
1024
+ }
1025
+
1026
+ result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
1027
+ Py_DECREF(new_args);
1028
+ } else {
1029
+ result = __Pyx_CyFunction_Call(func, args, kw);
1030
+ }
1031
+ return result;
1032
+ }
1033
+
1034
+ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
1035
+ // Check that kwnames is empty (if you want to allow keyword arguments,
1036
+ // simply pass kwnames=NULL) and figure out what to do with "self".
1037
+ // Return value:
1038
+ // 1: self = args[0]
1039
+ // 0: self = cyfunc->func.m_self
1040
+ // -1: error
1041
+ static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
1042
+ {
1043
+ int ret = 0;
1044
+ if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
1045
+ if (unlikely(nargs < 1)) {
1046
+ __Pyx_CyFunction_raise_type_error(
1047
+ cyfunc, "needs an argument");
1048
+ return -1;
1049
+ }
1050
+ ret = 1;
1051
+ }
1052
+ if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
1053
+ __Pyx_CyFunction_raise_type_error(
1054
+ cyfunc, "takes no keyword arguments");
1055
+ return -1;
1056
+ }
1057
+ return ret;
1058
+ }
1059
+
1060
+ static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
1061
+ {
1062
+ __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
1063
+ Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
1064
+ PyObject *self;
1065
+ #if CYTHON_COMPILING_IN_LIMITED_API
1066
+ PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
1067
+ if (unlikely(!meth)) return NULL;
1068
+ #else
1069
+ PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
1070
+ #endif
1071
+
1072
+ switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
1073
+ case 1:
1074
+ self = args[0];
1075
+ args += 1;
1076
+ nargs -= 1;
1077
+ break;
1078
+ case 0:
1079
+ #if CYTHON_COMPILING_IN_LIMITED_API
1080
+ // PyCFunction_GetSelf returns a borrowed reference
1081
+ self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
1082
+ if (unlikely(!self) && PyErr_Occurred()) return NULL;
1083
+ #else
1084
+ self = ((PyCFunctionObject*)cyfunc)->m_self;
1085
+ #endif
1086
+ break;
1087
+ default:
1088
+ return NULL;
1089
+ }
1090
+
1091
+ if (unlikely(nargs != 0)) {
1092
+ __Pyx_CyFunction_raise_argument_count_error(
1093
+ cyfunc, "takes no arguments", nargs);
1094
+ return NULL;
1095
+ }
1096
+ return meth(self, NULL);
1097
+ }
1098
+
1099
+ static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
1100
+ {
1101
+ __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
1102
+ Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
1103
+ PyObject *self;
1104
+ #if CYTHON_COMPILING_IN_LIMITED_API
1105
+ PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
1106
+ if (unlikely(!meth)) return NULL;
1107
+ #else
1108
+ PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
1109
+ #endif
1110
+
1111
+ switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
1112
+ case 1:
1113
+ self = args[0];
1114
+ args += 1;
1115
+ nargs -= 1;
1116
+ break;
1117
+ case 0:
1118
+ #if CYTHON_COMPILING_IN_LIMITED_API
1119
+ // PyCFunction_GetSelf returns a borrowed reference
1120
+ self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
1121
+ if (unlikely(!self) && PyErr_Occurred()) return NULL;
1122
+ #else
1123
+ self = ((PyCFunctionObject*)cyfunc)->m_self;
1124
+ #endif
1125
+ break;
1126
+ default:
1127
+ return NULL;
1128
+ }
1129
+
1130
+ if (unlikely(nargs != 1)) {
1131
+ __Pyx_CyFunction_raise_argument_count_error(
1132
+ cyfunc, "takes exactly one argument", nargs);
1133
+ return NULL;
1134
+ }
1135
+ return meth(self, args[0]);
1136
+ }
1137
+
1138
+ static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
1139
+ {
1140
+ __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
1141
+ Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
1142
+ PyObject *self;
1143
+ #if CYTHON_COMPILING_IN_LIMITED_API
1144
+ PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
1145
+ if (unlikely(!meth)) return NULL;
1146
+ #else
1147
+ PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
1148
+ #endif
1149
+
1150
+ switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
1151
+ case 1:
1152
+ self = args[0];
1153
+ args += 1;
1154
+ nargs -= 1;
1155
+ break;
1156
+ case 0:
1157
+ #if CYTHON_COMPILING_IN_LIMITED_API
1158
+ // PyCFunction_GetSelf returns a borrowed reference
1159
+ self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
1160
+ if (unlikely(!self) && PyErr_Occurred()) return NULL;
1161
+ #else
1162
+ self = ((PyCFunctionObject*)cyfunc)->m_self;
1163
+ #endif
1164
+ break;
1165
+ default:
1166
+ return NULL;
1167
+ }
1168
+
1169
+ return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
1170
+ }
1171
+
1172
+ static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
1173
+ {
1174
+ __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
1175
+ PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
1176
+ Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
1177
+ PyObject *self;
1178
+ #if CYTHON_COMPILING_IN_LIMITED_API
1179
+ PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
1180
+ if (unlikely(!meth)) return NULL;
1181
+ #else
1182
+ PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
1183
+ #endif
1184
+ switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
1185
+ case 1:
1186
+ self = args[0];
1187
+ args += 1;
1188
+ nargs -= 1;
1189
+ break;
1190
+ case 0:
1191
+ #if CYTHON_COMPILING_IN_LIMITED_API
1192
+ // PyCFunction_GetSelf returns a borrowed reference
1193
+ self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
1194
+ if (unlikely(!self) && PyErr_Occurred()) return NULL;
1195
+ #else
1196
+ self = ((PyCFunctionObject*)cyfunc)->m_self;
1197
+ #endif
1198
+ break;
1199
+ default:
1200
+ return NULL;
1201
+ }
1202
+
1203
+ #if PY_VERSION_HEX < 0x030e00A6
1204
+ // See https://github.com/python/cpython/pull/131135
1205
+ size_t nargs_value = (size_t) nargs;
1206
+ #else
1207
+ Py_ssize_t nargs_value = nargs;
1208
+ #endif
1209
+
1210
+ return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
1211
+ }
1212
+ #endif
1213
+
1214
+ static PyType_Slot __pyx_CyFunctionType_slots[] = {
1215
+ {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
1216
+ {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
1217
+ {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
1218
+ {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
1219
+ {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
1220
+ {Py_tp_methods, (void *)__pyx_CyFunction_methods},
1221
+ {Py_tp_members, (void *)__pyx_CyFunction_members},
1222
+ {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
1223
+ {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
1224
+ {0, 0},
1225
+ };
1226
+
1227
+ static PyType_Spec __pyx_CyFunctionType_spec = {
1228
+ __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
1229
+ sizeof(__pyx_CyFunctionObject),
1230
+ 0,
1231
+ #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
1232
+ Py_TPFLAGS_METHOD_DESCRIPTOR |
1233
+ #endif
1234
+ #if CYTHON_METH_FASTCALL
1235
+ #if defined(Py_TPFLAGS_HAVE_VECTORCALL)
1236
+ Py_TPFLAGS_HAVE_VECTORCALL |
1237
+ #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
1238
+ _Py_TPFLAGS_HAVE_VECTORCALL |
1239
+ #endif
1240
+ #endif // CYTHON_METH_FASTCALL
1241
+ #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
1242
+ Py_TPFLAGS_MANAGED_DICT |
1243
+ #endif
1244
+ Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
1245
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, /*tp_flags*/
1246
+ __pyx_CyFunctionType_slots
1247
+ };
1248
+
1249
+ static int __pyx_CyFunction_init(PyObject *module) {
1250
+ $modulestatetype_cname *mstate = __Pyx_PyModule_GetState(module);
1251
+ mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
1252
+ mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
1253
+ if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
1254
+ return -1;
1255
+ }
1256
+ return 0;
1257
+ }
1258
+
1259
+ static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
1260
+ __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
1261
+
1262
+ m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
1263
+ if (unlikely(!m->defaults))
1264
+ return NULL;
1265
+ return m->defaults;
1266
+ }
1267
+
1268
+ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
1269
+ __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
1270
+ m->defaults_tuple = tuple;
1271
+ Py_INCREF(tuple);
1272
+ }
1273
+
1274
+ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
1275
+ __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
1276
+ m->defaults_kwdict = dict;
1277
+ Py_INCREF(dict);
1278
+ }
1279
+
1280
+ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
1281
+ __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
1282
+ m->func_annotations = dict;
1283
+ Py_INCREF(dict);
1284
+ }
1285
+
1286
+
1287
+ //////////////////// CythonFunction.proto ////////////////////
1288
+
1289
+ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1290
+ int flags, PyObject* qualname,
1291
+ PyObject *closure,
1292
+ PyObject *module, PyObject *globals,
1293
+ PyObject* code);
1294
+
1295
+ //////////////////// CythonFunction ////////////////////
1296
+ //@requires: CythonFunctionShared
1297
+
1298
+ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
1299
+ PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
1300
+ PyObject *op = __Pyx_CyFunction_Init(
1301
+ PyObject_GC_New(__pyx_CyFunctionObject, CGLOBAL(__pyx_CyFunctionType)),
1302
+ ml, flags, qualname, closure, module, globals, code
1303
+ );
1304
+ if (likely(op)) {
1305
+ PyObject_GC_Track(op);
1306
+ }
1307
+ return op;
1308
+ }
1309
+
1310
+ //////////////////// CyFunctionClassCell.proto ////////////////////
1311
+ static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj);/*proto*/
1312
+
1313
+ //////////////////// CyFunctionClassCell ////////////////////
1314
+ //@requires: CythonFunctionShared
1315
+
1316
+ static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) {
1317
+ Py_ssize_t i, count = __Pyx_PyList_GET_SIZE(cyfunctions);
1318
+ #if !CYTHON_ASSUME_SAFE_SIZE
1319
+ if (unlikely(count < 0)) return -1;
1320
+ #endif
1321
+
1322
+ for (i = 0; i < count; i++) {
1323
+ __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *)
1324
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && !CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
1325
+ PyList_GET_ITEM(cyfunctions, i);
1326
+ #else
1327
+ __Pyx_PySequence_ITEM(cyfunctions, i);
1328
+ if (unlikely(!m))
1329
+ return -1;
1330
+ #endif
1331
+ __Pyx_CyFunction_SetClassObj(m, classobj);
1332
+ #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && !CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
1333
+ Py_DECREF((PyObject*)m);
1334
+ #endif
1335
+ }
1336
+ return 0;
1337
+ }
1338
+
1339
+ //////////////////// FusedFunction.module_state_decls ////////////////////
1340
+
1341
+ PyTypeObject *__pyx_FusedFunctionType;
1342
+
1343
+ //////////////////// FusedFunction.module_state_traverse ///////////////////
1344
+
1345
+ Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
1346
+
1347
+ //////////////////// FusedFunction.module_state_clear ///////////////////
1348
+
1349
+ Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
1350
+
1351
+ //////////////////// FusedFunction.init //////////////////
1352
+ //@substitute: naming
1353
+
1354
+ if (likely(__pyx_FusedFunction_init($module_cname) == 0)); else
1355
+
1356
+ //////////////////// FusedFunction.proto ////////////////////
1357
+
1358
+ typedef struct {
1359
+ __pyx_CyFunctionObject func;
1360
+ PyObject *__signatures__;
1361
+ PyObject *self;
1362
+ #if CYTHON_COMPILING_IN_LIMITED_API
1363
+ PyMethodDef *ml;
1364
+ #endif
1365
+ } __pyx_FusedFunctionObject;
1366
+
1367
+ static PyObject *__pyx_FusedFunction_New(PyMethodDef *ml, int flags,
1368
+ PyObject *qualname, PyObject *closure,
1369
+ PyObject *module, PyObject *globals,
1370
+ PyObject *code);
1371
+
1372
+ static int __pyx_FusedFunction_clear(__pyx_FusedFunctionObject *self);
1373
+ static int __pyx_FusedFunction_init(PyObject *module);
1374
+
1375
+ #define __Pyx_FusedFunction_USED
1376
+
1377
+ //////////////////// FusedFunction ////////////////////
1378
+ //@requires: CythonFunctionShared
1379
+ //@substitute: naming
1380
+
1381
+ static PyObject *
1382
+ __pyx_FusedFunction_New(PyMethodDef *ml, int flags,
1383
+ PyObject *qualname, PyObject *closure,
1384
+ PyObject *module, PyObject *globals,
1385
+ PyObject *code)
1386
+ {
1387
+ PyObject *op = __Pyx_CyFunction_Init(
1388
+ // __pyx_CyFunctionObject is correct below since that's the cast that we want.
1389
+ PyObject_GC_New(__pyx_CyFunctionObject, CGLOBAL(__pyx_FusedFunctionType)),
1390
+ ml, flags, qualname, closure, module, globals, code
1391
+ );
1392
+ if (likely(op)) {
1393
+ __pyx_FusedFunctionObject *fusedfunc = (__pyx_FusedFunctionObject *) op;
1394
+ fusedfunc->__signatures__ = NULL;
1395
+ fusedfunc->self = NULL;
1396
+ #if CYTHON_COMPILING_IN_LIMITED_API
1397
+ fusedfunc->ml = ml;
1398
+ #endif
1399
+ PyObject_GC_Track(op);
1400
+ }
1401
+ return op;
1402
+ }
1403
+
1404
+ static void
1405
+ __pyx_FusedFunction_dealloc(__pyx_FusedFunctionObject *self)
1406
+ {
1407
+ PyObject_GC_UnTrack(self);
1408
+ Py_CLEAR(self->self);
1409
+ Py_CLEAR(self->__signatures__);
1410
+ __Pyx__CyFunction_dealloc((__pyx_CyFunctionObject *) self);
1411
+ }
1412
+
1413
+ static int
1414
+ __pyx_FusedFunction_traverse(__pyx_FusedFunctionObject *self,
1415
+ visitproc visit,
1416
+ void *arg)
1417
+ {
1418
+ // Visiting the type is handled in the CyFunction traverse if needed
1419
+ Py_VISIT(self->self);
1420
+ Py_VISIT(self->__signatures__);
1421
+ return __Pyx_CyFunction_traverse((__pyx_CyFunctionObject *) self, visit, arg);
1422
+ }
1423
+
1424
+ static int
1425
+ __pyx_FusedFunction_clear(__pyx_FusedFunctionObject *self)
1426
+ {
1427
+ Py_CLEAR(self->self);
1428
+ Py_CLEAR(self->__signatures__);
1429
+ return __Pyx_CyFunction_clear((__pyx_CyFunctionObject *) self);
1430
+ }
1431
+
1432
+
1433
+ static __pyx_FusedFunctionObject *
1434
+ __pyx_FusedFunction_descr_get_locked(__pyx_FusedFunctionObject *func, PyObject *obj)
1435
+ {
1436
+ PyObject *module;
1437
+ __pyx_FusedFunctionObject *meth;
1438
+ #if CYTHON_COMPILING_IN_LIMITED_API
1439
+ module = __Pyx_CyFunction_get_module((__pyx_CyFunctionObject *) func, NULL);
1440
+ if ((unlikely(!module))) return NULL;
1441
+ #else
1442
+ module = ((PyCFunctionObject *) func)->m_module;
1443
+ #endif
1444
+
1445
+ meth = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_New(
1446
+ #if CYTHON_COMPILING_IN_LIMITED_API
1447
+ func->ml,
1448
+ #else
1449
+ ((PyCFunctionObject *) func)->m_ml,
1450
+ #endif
1451
+ ((__pyx_CyFunctionObject *) func)->flags,
1452
+ ((__pyx_CyFunctionObject *) func)->func_qualname,
1453
+ ((__pyx_CyFunctionObject *) func)->func_closure,
1454
+ module,
1455
+ ((__pyx_CyFunctionObject *) func)->func_globals,
1456
+ ((__pyx_CyFunctionObject *) func)->func_code);
1457
+ #if CYTHON_COMPILING_IN_LIMITED_API
1458
+ Py_DECREF(module);
1459
+ #endif
1460
+ if (unlikely(!meth))
1461
+ return NULL;
1462
+
1463
+ Py_XINCREF(func->func.defaults);
1464
+ meth->func.defaults = func->func.defaults;
1465
+
1466
+ __Pyx_CyFunction_SetClassObj(meth, __Pyx_CyFunction_GetClassObj(func));
1467
+
1468
+ Py_XINCREF(func->__signatures__);
1469
+ meth->__signatures__ = func->__signatures__;
1470
+
1471
+ Py_XINCREF(func->func.defaults_tuple);
1472
+ meth->func.defaults_tuple = func->func.defaults_tuple;
1473
+
1474
+ Py_XINCREF(obj);
1475
+ meth->self = obj;
1476
+ return meth;
1477
+ }
1478
+
1479
+ static PyObject *
1480
+ __pyx_FusedFunction_descr_get(PyObject *self, PyObject *obj, PyObject *type)
1481
+ {
1482
+ __pyx_FusedFunctionObject *func, *meth;
1483
+
1484
+ func = (__pyx_FusedFunctionObject *) self;
1485
+
1486
+ if (func->self || func->func.flags & __Pyx_CYFUNCTION_STATICMETHOD) {
1487
+ // Do not allow rebinding and don't do anything for static methods
1488
+ Py_INCREF(self);
1489
+ return self;
1490
+ }
1491
+
1492
+ if (obj == Py_None)
1493
+ obj = NULL;
1494
+
1495
+ if (func->func.flags & __Pyx_CYFUNCTION_CLASSMETHOD)
1496
+ obj = type;
1497
+
1498
+ if (obj == NULL) {
1499
+ // We aren't actually binding to anything, save the effort of rebinding
1500
+ Py_INCREF(self);
1501
+ return self;
1502
+ }
1503
+
1504
+ __Pyx_BEGIN_CRITICAL_SECTION(func);
1505
+ meth = __pyx_FusedFunction_descr_get_locked(func, obj);
1506
+ __Pyx_END_CRITICAL_SECTION()
1507
+
1508
+ return (PyObject *) meth;
1509
+ }
1510
+
1511
+ static PyObject *
1512
+ _obj_to_string(PyObject *obj)
1513
+ {
1514
+ if (PyUnicode_CheckExact(obj))
1515
+ return __Pyx_NewRef(obj);
1516
+ else if (PyType_Check(obj))
1517
+ return PyObject_GetAttr(obj, PYIDENT("__name__"));
1518
+ else
1519
+ return PyObject_Str(obj);
1520
+ }
1521
+
1522
+ static PyObject *
1523
+ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx)
1524
+ {
1525
+ PyObject *signature = NULL;
1526
+ PyObject *unbound_result_func;
1527
+ PyObject *result_func = NULL;
1528
+
1529
+ if (unlikely(self->__signatures__ == NULL)) {
1530
+ PyErr_SetString(PyExc_TypeError, "Function is not fused");
1531
+ return NULL;
1532
+ }
1533
+
1534
+ if (PyTuple_Check(idx)) {
1535
+ Py_ssize_t n = __Pyx_PyTuple_GET_SIZE(idx);
1536
+ PyObject *list;
1537
+ int i;
1538
+ #if !CYTHON_ASSUME_SAFE_SIZE
1539
+ if (unlikely(n < 0)) return NULL;
1540
+ #endif
1541
+
1542
+ list = PyList_New(n);
1543
+ if (unlikely(!list))
1544
+ return NULL;
1545
+
1546
+ for (i = 0; i < n; i++) {
1547
+ PyObject *string;
1548
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
1549
+ PyObject *item = PyTuple_GET_ITEM(idx, i);
1550
+ #else
1551
+ PyObject *item = __Pyx_PySequence_ITEM(idx, i); if (unlikely(!item)) goto __pyx_err;
1552
+ #endif
1553
+ string = _obj_to_string(item);
1554
+ #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
1555
+ Py_DECREF(item);
1556
+ #endif
1557
+ if (unlikely(!string)) goto __pyx_err;
1558
+ if (__Pyx_PyList_SET_ITEM(list, i, string) < (0)) goto __pyx_err;
1559
+ }
1560
+
1561
+ signature = PyUnicode_Join(PYUNICODE("|"), list);
1562
+ __pyx_err:;
1563
+ Py_DECREF(list);
1564
+ } else {
1565
+ signature = _obj_to_string(idx);
1566
+ }
1567
+
1568
+ if (unlikely(!signature))
1569
+ return NULL;
1570
+
1571
+ unbound_result_func = PyObject_GetItem(self->__signatures__, signature);
1572
+
1573
+ if (likely(unbound_result_func)) {
1574
+ if (self->self) {
1575
+ __pyx_FusedFunctionObject *unbound = (__pyx_FusedFunctionObject *) unbound_result_func;
1576
+
1577
+ // TODO: move this to InitClassCell
1578
+ __Pyx_CyFunction_SetClassObj(unbound, __Pyx_CyFunction_GetClassObj(self));
1579
+
1580
+ result_func = __pyx_FusedFunction_descr_get(unbound_result_func,
1581
+ self->self, self->self);
1582
+ } else {
1583
+ result_func = unbound_result_func;
1584
+ Py_INCREF(result_func);
1585
+ }
1586
+ }
1587
+
1588
+ Py_DECREF(signature);
1589
+ Py_XDECREF(unbound_result_func);
1590
+
1591
+ return result_func;
1592
+ }
1593
+
1594
+ static PyObject *
1595
+ __pyx_FusedFunction_callfunction(PyObject *func, PyObject *args, PyObject *kw)
1596
+ {
1597
+ __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
1598
+ int static_specialized = (cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD &&
1599
+ !((__pyx_FusedFunctionObject *) func)->__signatures__);
1600
+
1601
+ if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !static_specialized) {
1602
+ return __Pyx_CyFunction_CallAsMethod(func, args, kw);
1603
+ } else {
1604
+ return __Pyx_CyFunction_Call(func, args, kw);
1605
+ }
1606
+ }
1607
+
1608
+ // Note: the 'self' from method binding is passed in in the args tuple,
1609
+ // whereas PyCFunctionObject's m_self is passed in as the first
1610
+ // argument to the C function. For extension methods we need
1611
+ // to pass 'self' as 'm_self' and not as the first element of the
1612
+ // args tuple.
1613
+
1614
+ static PyObject *
1615
+ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
1616
+ {
1617
+ __pyx_FusedFunctionObject *binding_func = (__pyx_FusedFunctionObject *) func;
1618
+ Py_ssize_t argc = __Pyx_PyTuple_GET_SIZE(args);
1619
+ PyObject *new_args = NULL;
1620
+ __pyx_FusedFunctionObject *new_func = NULL;
1621
+ PyObject *result = NULL;
1622
+ int is_staticmethod = binding_func->func.flags & __Pyx_CYFUNCTION_STATICMETHOD;
1623
+ #if !CYTHON_ASSUME_SAFE_SIZE
1624
+ if (unlikely(argc < 0)) return NULL;
1625
+ #endif
1626
+
1627
+ if (binding_func->self) {
1628
+ // Bound method call, put 'self' in the args tuple
1629
+ PyObject *self;
1630
+ Py_ssize_t i;
1631
+ new_args = PyTuple_New(argc + 1);
1632
+ if (unlikely(!new_args))
1633
+ return NULL;
1634
+
1635
+ self = binding_func->self;
1636
+
1637
+ Py_INCREF(self);
1638
+ if (__Pyx_PyTuple_SET_ITEM(new_args, 0, self) < (0)) goto bad;
1639
+ self = NULL;
1640
+
1641
+ for (i = 0; i < argc; i++) {
1642
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
1643
+ PyObject *item = PyTuple_GET_ITEM(args, i);
1644
+ Py_INCREF(item);
1645
+ #else
1646
+ PyObject *item = __Pyx_PySequence_ITEM(args, i); if (unlikely(!item)) goto bad;
1647
+ #endif
1648
+ if (__Pyx_PyTuple_SET_ITEM(new_args, i + 1, item) < (0)) goto bad;
1649
+ }
1650
+
1651
+ args = new_args;
1652
+ }
1653
+
1654
+ if (binding_func->__signatures__) {
1655
+ PyObject *tup;
1656
+ if (is_staticmethod && binding_func->func.flags & __Pyx_CYFUNCTION_CCLASS) {
1657
+ // FIXME: this seems wrong, but we must currently pass the signatures dict as 'self' argument
1658
+ tup = PyTuple_Pack(3, args,
1659
+ kw == NULL ? Py_None : kw,
1660
+ binding_func->func.defaults_tuple);
1661
+ if (unlikely(!tup)) goto bad;
1662
+ new_func = (__pyx_FusedFunctionObject *) __Pyx_CyFunction_CallMethod(
1663
+ func, binding_func->__signatures__, tup, NULL);
1664
+ } else {
1665
+ tup = PyTuple_Pack(4, binding_func->__signatures__, args,
1666
+ kw == NULL ? Py_None : kw,
1667
+ binding_func->func.defaults_tuple);
1668
+ if (unlikely(!tup)) goto bad;
1669
+ new_func = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_callfunction(func, tup, NULL);
1670
+ }
1671
+ Py_DECREF(tup);
1672
+
1673
+ if (unlikely(!new_func))
1674
+ goto bad;
1675
+
1676
+ __Pyx_CyFunction_SetClassObj(new_func, __Pyx_CyFunction_GetClassObj(binding_func));
1677
+
1678
+ func = (PyObject *) new_func;
1679
+ }
1680
+
1681
+ result = __pyx_FusedFunction_callfunction(func, args, kw);
1682
+ bad:
1683
+ Py_XDECREF(new_args);
1684
+ Py_XDECREF((PyObject *) new_func);
1685
+ return result;
1686
+ }
1687
+
1688
+ static PyMemberDef __pyx_FusedFunction_members[] = {
1689
+ {"__signatures__",
1690
+ T_OBJECT,
1691
+ offsetof(__pyx_FusedFunctionObject, __signatures__),
1692
+ READONLY,
1693
+ 0},
1694
+ {"__self__", T_OBJECT_EX, offsetof(__pyx_FusedFunctionObject, self), READONLY, 0},
1695
+ // For heap-types __module__ appears not to be inherited (so redeclare)
1696
+ #if !CYTHON_COMPILING_IN_LIMITED_API
1697
+ {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
1698
+ #endif
1699
+ {0, 0, 0, 0, 0},
1700
+ };
1701
+
1702
+ static PyGetSetDef __pyx_FusedFunction_getsets[] = {
1703
+ // __doc__ is None for the fused function type, but we need it to be
1704
+ // a descriptor for the instance's __doc__, so rebuild the descriptor in our subclass
1705
+ // (all other descriptors are inherited)
1706
+ {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
1707
+ // For heap-types __module__ appears not to be inherited (so redeclare)
1708
+ #if CYTHON_COMPILING_IN_LIMITED_API
1709
+ {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
1710
+ #endif
1711
+ {0, 0, 0, 0, 0}
1712
+ };
1713
+
1714
+ static PyType_Slot __pyx_FusedFunctionType_slots[] = {
1715
+ {Py_tp_dealloc, (void *)__pyx_FusedFunction_dealloc},
1716
+ {Py_tp_call, (void *)__pyx_FusedFunction_call},
1717
+ {Py_tp_traverse, (void *)__pyx_FusedFunction_traverse},
1718
+ {Py_tp_clear, (void *)__pyx_FusedFunction_clear},
1719
+ {Py_tp_members, (void *)__pyx_FusedFunction_members},
1720
+ {Py_tp_getset, (void *)__pyx_FusedFunction_getsets},
1721
+ {Py_tp_descr_get, (void *)__pyx_FusedFunction_descr_get},
1722
+ {Py_mp_subscript, (void *)__pyx_FusedFunction_getitem},
1723
+ {0, 0},
1724
+ };
1725
+
1726
+ static PyType_Spec __pyx_FusedFunctionType_spec = {
1727
+ __PYX_TYPE_MODULE_PREFIX "fused_cython_function",
1728
+ sizeof(__pyx_FusedFunctionObject),
1729
+ 0,
1730
+ Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
1731
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC , /*tp_flags*/
1732
+ __pyx_FusedFunctionType_slots
1733
+ };
1734
+
1735
+ static int __pyx_FusedFunction_init(PyObject *module) {
1736
+ $modulestatetype_cname *mstate = __Pyx_PyModule_GetState(module);
1737
+ PyObject *bases = PyTuple_Pack(1, mstate->__pyx_CyFunctionType);
1738
+ if (unlikely(!bases)) {
1739
+ return -1;
1740
+ }
1741
+ mstate->__pyx_FusedFunctionType = __Pyx_FetchCommonTypeFromSpec(
1742
+ mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_FusedFunctionType_spec, bases);
1743
+ Py_DECREF(bases);
1744
+ if (unlikely(mstate->__pyx_FusedFunctionType == NULL)) {
1745
+ return -1;
1746
+ }
1747
+ return 0;
1748
+ }
1749
+
1750
+ //////////////////// ClassMethod.proto ////////////////////
1751
+
1752
+ #if !CYTHON_COMPILING_IN_LIMITED_API
1753
+ #include "descrobject.h"
1754
+ #endif
1755
+ CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/
1756
+
1757
+ //////////////////// ClassMethod ////////////////////
1758
+ //@requires: ObjectHandling.c::CachedMethodType
1759
+
1760
+ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
1761
+ #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
1762
+ if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
1763
+ // cdef classes
1764
+ return PyClassMethod_New(method);
1765
+ }
1766
+ #else
1767
+ #if CYTHON_COMPILING_IN_PYPY
1768
+ // special C-API function only in PyPy >= 5.9
1769
+ if (PyMethodDescr_Check(method))
1770
+ #else
1771
+ if (__Pyx_TypeCheck(method, &PyMethodDescr_Type))
1772
+ #endif
1773
+ {
1774
+ #if CYTHON_COMPILING_IN_LIMITED_API
1775
+ return PyErr_Format(
1776
+ PyExc_SystemError,
1777
+ "Cython cannot yet handle classmethod on a MethodDescriptorType (%S) in limited API mode. "
1778
+ "This is most likely a classmethod in a cdef class method with binding=False. "
1779
+ "Try setting 'binding' to True.",
1780
+ method);
1781
+ #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
1782
+ // cdef classes
1783
+ PyTypeObject *d_type = GraalPyDescrObject_GetType(method);
1784
+ return PyDescr_NewClassMethod(d_type, GraalPyMethodDescrObject_GetMethod(method));
1785
+ #elif CYTHON_COMPILING_IN_GRAAL
1786
+ // Remove when GraalPy 24 goes EOL
1787
+ PyTypeObject *d_type = PyDescrObject_GetType(method);
1788
+ return PyDescr_NewClassMethod(d_type, PyMethodDescrObject_GetMethod(method));
1789
+ #else
1790
+ // cdef classes
1791
+ PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
1792
+ PyTypeObject *d_type = descr->d_common.d_type;
1793
+ return PyDescr_NewClassMethod(d_type, descr->d_method);
1794
+ #endif
1795
+ }
1796
+ #endif
1797
+ #if !CYTHON_COMPILING_IN_LIMITED_API
1798
+ else if (PyMethod_Check(method)) {
1799
+ // python classes
1800
+ return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
1801
+ }
1802
+ else {
1803
+ return PyClassMethod_New(method);
1804
+ }
1805
+ #else
1806
+ {
1807
+ PyObject *func=NULL;
1808
+ PyObject *builtins, *classmethod, *classmethod_str, *result=NULL;
1809
+ if (__Pyx_TypeCheck(method, CGLOBAL(__Pyx_CachedMethodType))) {
1810
+ func = PyObject_GetAttrString(method, "__func__");
1811
+ if (!func) goto bad;
1812
+ } else {
1813
+ func = method;
1814
+ Py_INCREF(func);
1815
+ }
1816
+ builtins = PyEval_GetBuiltins(); // borrowed
1817
+ if (unlikely(!builtins)) goto bad;
1818
+ classmethod_str = PyUnicode_FromString("classmethod");
1819
+ if (unlikely(!classmethod_str)) goto bad;
1820
+ classmethod = PyObject_GetItem(builtins, classmethod_str);
1821
+ Py_DECREF(classmethod_str);
1822
+ if (unlikely(!classmethod)) goto bad;
1823
+ result = PyObject_CallFunctionObjArgs(classmethod, func, NULL);
1824
+ Py_DECREF(classmethod);
1825
+
1826
+ bad:
1827
+ Py_XDECREF(func);
1828
+ return result;
1829
+ }
1830
+ #endif
1831
+
1832
+ }