Cython 3.1.0a1__py3-none-any.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 (301) hide show
  1. Cython/Build/BuildExecutable.py +169 -0
  2. Cython/Build/Cache.py +199 -0
  3. Cython/Build/Cythonize.py +250 -0
  4. Cython/Build/Dependencies.py +1275 -0
  5. Cython/Build/Distutils.py +1 -0
  6. Cython/Build/Inline.py +342 -0
  7. Cython/Build/IpythonMagic.py +560 -0
  8. Cython/Build/Tests/TestCyCache.py +119 -0
  9. Cython/Build/Tests/TestCythonizeArgsParser.py +481 -0
  10. Cython/Build/Tests/TestDependencies.py +133 -0
  11. Cython/Build/Tests/TestInline.py +112 -0
  12. Cython/Build/Tests/TestIpythonMagic.py +287 -0
  13. Cython/Build/Tests/TestRecythonize.py +212 -0
  14. Cython/Build/Tests/TestStripLiterals.py +155 -0
  15. Cython/Build/Tests/__init__.py +1 -0
  16. Cython/Build/__init__.py +8 -0
  17. Cython/CodeWriter.py +811 -0
  18. Cython/Compiler/AnalysedTreeTransforms.py +97 -0
  19. Cython/Compiler/Annotate.py +326 -0
  20. Cython/Compiler/AutoDocTransforms.py +314 -0
  21. Cython/Compiler/Buffer.py +680 -0
  22. Cython/Compiler/Builtin.py +862 -0
  23. Cython/Compiler/CmdLine.py +243 -0
  24. Cython/Compiler/Code.pxd +145 -0
  25. Cython/Compiler/Code.py +3328 -0
  26. Cython/Compiler/CodeGeneration.py +33 -0
  27. Cython/Compiler/CythonScope.py +179 -0
  28. Cython/Compiler/Dataclass.py +868 -0
  29. Cython/Compiler/DebugFlags.py +21 -0
  30. Cython/Compiler/Errors.py +295 -0
  31. Cython/Compiler/ExprNodes.py +15051 -0
  32. Cython/Compiler/FlowControl.pxd +97 -0
  33. Cython/Compiler/FlowControl.py +1438 -0
  34. Cython/Compiler/FusedNode.py +998 -0
  35. Cython/Compiler/Future.py +16 -0
  36. Cython/Compiler/Interpreter.py +57 -0
  37. Cython/Compiler/Lexicon.py +340 -0
  38. Cython/Compiler/LineTable.py +114 -0
  39. Cython/Compiler/Main.py +779 -0
  40. Cython/Compiler/MatchCaseNodes.py +259 -0
  41. Cython/Compiler/MemoryView.py +860 -0
  42. Cython/Compiler/ModuleNode.py +4065 -0
  43. Cython/Compiler/Naming.py +369 -0
  44. Cython/Compiler/Nodes.py +10557 -0
  45. Cython/Compiler/Optimize.py +5269 -0
  46. Cython/Compiler/Options.py +828 -0
  47. Cython/Compiler/ParseTreeTransforms.pxd +78 -0
  48. Cython/Compiler/ParseTreeTransforms.py +4441 -0
  49. Cython/Compiler/Parsing.pxd +9 -0
  50. Cython/Compiler/Parsing.py +4797 -0
  51. Cython/Compiler/Pipeline.py +425 -0
  52. Cython/Compiler/PyrexTypes.py +5572 -0
  53. Cython/Compiler/Pythran.py +223 -0
  54. Cython/Compiler/Scanning.pxd +40 -0
  55. Cython/Compiler/Scanning.py +574 -0
  56. Cython/Compiler/StringEncoding.py +347 -0
  57. Cython/Compiler/Symtab.py +2998 -0
  58. Cython/Compiler/Tests/TestBuffer.py +105 -0
  59. Cython/Compiler/Tests/TestBuiltin.py +72 -0
  60. Cython/Compiler/Tests/TestCmdLine.py +573 -0
  61. Cython/Compiler/Tests/TestCode.py +86 -0
  62. Cython/Compiler/Tests/TestFlowControl.py +65 -0
  63. Cython/Compiler/Tests/TestGrammar.py +202 -0
  64. Cython/Compiler/Tests/TestMemView.py +71 -0
  65. Cython/Compiler/Tests/TestParseTreeTransforms.py +285 -0
  66. Cython/Compiler/Tests/TestScanning.py +134 -0
  67. Cython/Compiler/Tests/TestSignatureMatching.py +73 -0
  68. Cython/Compiler/Tests/TestStringEncoding.py +33 -0
  69. Cython/Compiler/Tests/TestTreeFragment.py +63 -0
  70. Cython/Compiler/Tests/TestTreePath.py +93 -0
  71. Cython/Compiler/Tests/TestTypes.py +75 -0
  72. Cython/Compiler/Tests/TestUtilityLoad.py +112 -0
  73. Cython/Compiler/Tests/TestVisitor.py +61 -0
  74. Cython/Compiler/Tests/Utils.py +36 -0
  75. Cython/Compiler/Tests/__init__.py +1 -0
  76. Cython/Compiler/TreeFragment.py +278 -0
  77. Cython/Compiler/TreePath.py +290 -0
  78. Cython/Compiler/TypeInference.py +584 -0
  79. Cython/Compiler/TypeSlots.py +1181 -0
  80. Cython/Compiler/UFuncs.py +311 -0
  81. Cython/Compiler/UtilNodes.py +387 -0
  82. Cython/Compiler/UtilityCode.py +274 -0
  83. Cython/Compiler/Version.py +8 -0
  84. Cython/Compiler/Visitor.pxd +53 -0
  85. Cython/Compiler/Visitor.py +861 -0
  86. Cython/Compiler/__init__.py +1 -0
  87. Cython/Coverage.py +443 -0
  88. Cython/Debugger/Cygdb.py +179 -0
  89. Cython/Debugger/DebugWriter.py +82 -0
  90. Cython/Debugger/Tests/TestLibCython.py +275 -0
  91. Cython/Debugger/Tests/__init__.py +1 -0
  92. Cython/Debugger/Tests/cfuncs.c +8 -0
  93. Cython/Debugger/Tests/codefile +49 -0
  94. Cython/Debugger/Tests/test_libcython_in_gdb.py +578 -0
  95. Cython/Debugger/Tests/test_libpython_in_gdb.py +90 -0
  96. Cython/Debugger/__init__.py +1 -0
  97. Cython/Debugger/libcython.py +1549 -0
  98. Cython/Debugger/libpython.py +2821 -0
  99. Cython/Debugging.py +20 -0
  100. Cython/Distutils/__init__.py +2 -0
  101. Cython/Distutils/build_ext.py +137 -0
  102. Cython/Distutils/extension.py +96 -0
  103. Cython/Distutils/old_build_ext.py +351 -0
  104. Cython/Includes/cpython/__init__.pxd +173 -0
  105. Cython/Includes/cpython/array.pxd +174 -0
  106. Cython/Includes/cpython/bool.pxd +37 -0
  107. Cython/Includes/cpython/buffer.pxd +112 -0
  108. Cython/Includes/cpython/bytearray.pxd +33 -0
  109. Cython/Includes/cpython/bytes.pxd +200 -0
  110. Cython/Includes/cpython/cellobject.pxd +35 -0
  111. Cython/Includes/cpython/ceval.pxd +8 -0
  112. Cython/Includes/cpython/codecs.pxd +121 -0
  113. Cython/Includes/cpython/complex.pxd +55 -0
  114. Cython/Includes/cpython/contextvars.pxd +141 -0
  115. Cython/Includes/cpython/conversion.pxd +36 -0
  116. Cython/Includes/cpython/datetime.pxd +384 -0
  117. Cython/Includes/cpython/descr.pxd +26 -0
  118. Cython/Includes/cpython/dict.pxd +187 -0
  119. Cython/Includes/cpython/exc.pxd +263 -0
  120. Cython/Includes/cpython/fileobject.pxd +57 -0
  121. Cython/Includes/cpython/float.pxd +47 -0
  122. Cython/Includes/cpython/function.pxd +65 -0
  123. Cython/Includes/cpython/genobject.pxd +25 -0
  124. Cython/Includes/cpython/getargs.pxd +12 -0
  125. Cython/Includes/cpython/instance.pxd +25 -0
  126. Cython/Includes/cpython/iterator.pxd +36 -0
  127. Cython/Includes/cpython/iterobject.pxd +24 -0
  128. Cython/Includes/cpython/list.pxd +92 -0
  129. Cython/Includes/cpython/long.pxd +149 -0
  130. Cython/Includes/cpython/longintrepr.pxd +19 -0
  131. Cython/Includes/cpython/mapping.pxd +63 -0
  132. Cython/Includes/cpython/marshal.pxd +66 -0
  133. Cython/Includes/cpython/mem.pxd +120 -0
  134. Cython/Includes/cpython/memoryview.pxd +50 -0
  135. Cython/Includes/cpython/method.pxd +49 -0
  136. Cython/Includes/cpython/module.pxd +208 -0
  137. Cython/Includes/cpython/number.pxd +258 -0
  138. Cython/Includes/cpython/object.pxd +433 -0
  139. Cython/Includes/cpython/pycapsule.pxd +143 -0
  140. Cython/Includes/cpython/pylifecycle.pxd +68 -0
  141. Cython/Includes/cpython/pyport.pxd +8 -0
  142. Cython/Includes/cpython/pystate.pxd +95 -0
  143. Cython/Includes/cpython/pythread.pxd +53 -0
  144. Cython/Includes/cpython/ref.pxd +67 -0
  145. Cython/Includes/cpython/sequence.pxd +134 -0
  146. Cython/Includes/cpython/set.pxd +119 -0
  147. Cython/Includes/cpython/slice.pxd +70 -0
  148. Cython/Includes/cpython/time.pxd +129 -0
  149. Cython/Includes/cpython/tuple.pxd +72 -0
  150. Cython/Includes/cpython/type.pxd +53 -0
  151. Cython/Includes/cpython/unicode.pxd +639 -0
  152. Cython/Includes/cpython/version.pxd +32 -0
  153. Cython/Includes/cpython/weakref.pxd +42 -0
  154. Cython/Includes/libc/__init__.pxd +1 -0
  155. Cython/Includes/libc/complex.pxd +35 -0
  156. Cython/Includes/libc/errno.pxd +127 -0
  157. Cython/Includes/libc/float.pxd +43 -0
  158. Cython/Includes/libc/limits.pxd +28 -0
  159. Cython/Includes/libc/locale.pxd +46 -0
  160. Cython/Includes/libc/math.pxd +209 -0
  161. Cython/Includes/libc/setjmp.pxd +10 -0
  162. Cython/Includes/libc/signal.pxd +64 -0
  163. Cython/Includes/libc/stddef.pxd +9 -0
  164. Cython/Includes/libc/stdint.pxd +105 -0
  165. Cython/Includes/libc/stdio.pxd +80 -0
  166. Cython/Includes/libc/stdlib.pxd +72 -0
  167. Cython/Includes/libc/string.pxd +50 -0
  168. Cython/Includes/libc/time.pxd +47 -0
  169. Cython/Includes/libcpp/__init__.pxd +4 -0
  170. Cython/Includes/libcpp/algorithm.pxd +320 -0
  171. Cython/Includes/libcpp/any.pxd +16 -0
  172. Cython/Includes/libcpp/atomic.pxd +59 -0
  173. Cython/Includes/libcpp/bit.pxd +29 -0
  174. Cython/Includes/libcpp/cast.pxd +12 -0
  175. Cython/Includes/libcpp/cmath.pxd +518 -0
  176. Cython/Includes/libcpp/complex.pxd +106 -0
  177. Cython/Includes/libcpp/deque.pxd +165 -0
  178. Cython/Includes/libcpp/execution.pxd +15 -0
  179. Cython/Includes/libcpp/forward_list.pxd +63 -0
  180. Cython/Includes/libcpp/functional.pxd +26 -0
  181. Cython/Includes/libcpp/iterator.pxd +34 -0
  182. Cython/Includes/libcpp/limits.pxd +61 -0
  183. Cython/Includes/libcpp/list.pxd +117 -0
  184. Cython/Includes/libcpp/map.pxd +252 -0
  185. Cython/Includes/libcpp/memory.pxd +115 -0
  186. Cython/Includes/libcpp/numbers.pxd +15 -0
  187. Cython/Includes/libcpp/numeric.pxd +131 -0
  188. Cython/Includes/libcpp/optional.pxd +34 -0
  189. Cython/Includes/libcpp/pair.pxd +1 -0
  190. Cython/Includes/libcpp/queue.pxd +25 -0
  191. Cython/Includes/libcpp/random.pxd +166 -0
  192. Cython/Includes/libcpp/set.pxd +228 -0
  193. Cython/Includes/libcpp/stack.pxd +11 -0
  194. Cython/Includes/libcpp/string.pxd +333 -0
  195. Cython/Includes/libcpp/typeindex.pxd +15 -0
  196. Cython/Includes/libcpp/typeinfo.pxd +10 -0
  197. Cython/Includes/libcpp/unordered_map.pxd +193 -0
  198. Cython/Includes/libcpp/unordered_set.pxd +152 -0
  199. Cython/Includes/libcpp/utility.pxd +30 -0
  200. Cython/Includes/libcpp/vector.pxd +167 -0
  201. Cython/Includes/openmp.pxd +50 -0
  202. Cython/Includes/posix/__init__.pxd +1 -0
  203. Cython/Includes/posix/dlfcn.pxd +14 -0
  204. Cython/Includes/posix/fcntl.pxd +86 -0
  205. Cython/Includes/posix/ioctl.pxd +4 -0
  206. Cython/Includes/posix/mman.pxd +101 -0
  207. Cython/Includes/posix/resource.pxd +57 -0
  208. Cython/Includes/posix/select.pxd +21 -0
  209. Cython/Includes/posix/signal.pxd +73 -0
  210. Cython/Includes/posix/stat.pxd +98 -0
  211. Cython/Includes/posix/stdio.pxd +37 -0
  212. Cython/Includes/posix/stdlib.pxd +29 -0
  213. Cython/Includes/posix/strings.pxd +9 -0
  214. Cython/Includes/posix/time.pxd +71 -0
  215. Cython/Includes/posix/types.pxd +30 -0
  216. Cython/Includes/posix/uio.pxd +26 -0
  217. Cython/Includes/posix/unistd.pxd +271 -0
  218. Cython/Includes/posix/wait.pxd +38 -0
  219. Cython/Plex/Actions.pxd +24 -0
  220. Cython/Plex/Actions.py +119 -0
  221. Cython/Plex/DFA.pxd +14 -0
  222. Cython/Plex/DFA.py +164 -0
  223. Cython/Plex/Errors.py +48 -0
  224. Cython/Plex/Lexicons.py +178 -0
  225. Cython/Plex/Machines.pxd +36 -0
  226. Cython/Plex/Machines.py +238 -0
  227. Cython/Plex/Regexps.py +539 -0
  228. Cython/Plex/Scanners.pxd +47 -0
  229. Cython/Plex/Scanners.py +360 -0
  230. Cython/Plex/Transitions.pxd +14 -0
  231. Cython/Plex/Transitions.py +239 -0
  232. Cython/Plex/__init__.py +34 -0
  233. Cython/Runtime/__init__.py +1 -0
  234. Cython/Runtime/refnanny.pyx +261 -0
  235. Cython/Shadow.py +656 -0
  236. Cython/Shadow.pyi +521 -0
  237. Cython/StringIOTree.py +170 -0
  238. Cython/Tempita/__init__.py +4 -0
  239. Cython/Tempita/_looper.py +154 -0
  240. Cython/Tempita/_tempita.py +1091 -0
  241. Cython/TestUtils.py +417 -0
  242. Cython/Tests/TestCodeWriter.py +128 -0
  243. Cython/Tests/TestCythonUtils.py +202 -0
  244. Cython/Tests/TestJediTyper.py +223 -0
  245. Cython/Tests/TestShadow.py +114 -0
  246. Cython/Tests/TestStringIOTree.py +67 -0
  247. Cython/Tests/TestTestUtils.py +90 -0
  248. Cython/Tests/__init__.py +1 -0
  249. Cython/Tests/xmlrunner.py +390 -0
  250. Cython/Utility/AsyncGen.c +1263 -0
  251. Cython/Utility/Buffer.c +875 -0
  252. Cython/Utility/Builtins.c +660 -0
  253. Cython/Utility/CConvert.pyx +134 -0
  254. Cython/Utility/CMath.c +95 -0
  255. Cython/Utility/CommonStructures.c +139 -0
  256. Cython/Utility/Complex.c +378 -0
  257. Cython/Utility/Coroutine.c +2413 -0
  258. Cython/Utility/CpdefEnums.pyx +108 -0
  259. Cython/Utility/CppConvert.pyx +279 -0
  260. Cython/Utility/CppSupport.cpp +133 -0
  261. Cython/Utility/CythonFunction.c +1851 -0
  262. Cython/Utility/Dataclasses.c +185 -0
  263. Cython/Utility/Dataclasses.py +112 -0
  264. Cython/Utility/Embed.c +125 -0
  265. Cython/Utility/Exceptions.c +1017 -0
  266. Cython/Utility/ExtensionTypes.c +797 -0
  267. Cython/Utility/FunctionArguments.c +573 -0
  268. Cython/Utility/ImportExport.c +912 -0
  269. Cython/Utility/MemoryView.pyx +1478 -0
  270. Cython/Utility/MemoryView_C.c +992 -0
  271. Cython/Utility/ModuleSetupCode.c +2501 -0
  272. Cython/Utility/NumpyImportArray.c +46 -0
  273. Cython/Utility/ObjectHandling.c +3054 -0
  274. Cython/Utility/Optimize.c +1533 -0
  275. Cython/Utility/Overflow.c +404 -0
  276. Cython/Utility/Printing.c +86 -0
  277. Cython/Utility/Profile.c +660 -0
  278. Cython/Utility/StringTools.c +1206 -0
  279. Cython/Utility/TestCyUtilityLoader.pyx +8 -0
  280. Cython/Utility/TestCythonScope.pyx +75 -0
  281. Cython/Utility/TestUtilityLoader.c +12 -0
  282. Cython/Utility/TypeConversion.c +1329 -0
  283. Cython/Utility/UFuncs.pyx +50 -0
  284. Cython/Utility/UFuncs_C.c +89 -0
  285. Cython/Utility/__init__.py +28 -0
  286. Cython/Utility/arrayarray.h +143 -0
  287. Cython/Utils.py +687 -0
  288. Cython/__init__.py +10 -0
  289. Cython/__init__.pyi +7 -0
  290. Cython/py.typed +0 -0
  291. Cython-3.1.0a1.dist-info/COPYING.txt +19 -0
  292. Cython-3.1.0a1.dist-info/LICENSE.txt +176 -0
  293. Cython-3.1.0a1.dist-info/METADATA +67 -0
  294. Cython-3.1.0a1.dist-info/RECORD +301 -0
  295. Cython-3.1.0a1.dist-info/WHEEL +5 -0
  296. Cython-3.1.0a1.dist-info/entry_points.txt +4 -0
  297. Cython-3.1.0a1.dist-info/top_level.txt +3 -0
  298. cython.py +29 -0
  299. pyximport/__init__.py +4 -0
  300. pyximport/pyxbuild.py +160 -0
  301. pyximport/pyximport.py +482 -0
@@ -0,0 +1,2501 @@
1
+ /////////////// InitLimitedAPI ///////////////
2
+
3
+ #if defined(Py_LIMITED_API) && !defined(CYTHON_LIMITED_API)
4
+ // Use Py_LIMITED_API as the main control for Cython's limited API mode.
5
+ // However it's still possible to define CYTHON_LIMITED_API alone to
6
+ // force Cython to use Limited-API code without enforcing it in Python.
7
+ #define CYTHON_LIMITED_API 1
8
+ #endif
9
+
10
+ /////////////// CModulePreamble ///////////////
11
+
12
+ #include <stddef.h> /* For offsetof */
13
+ #ifndef offsetof
14
+ #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
15
+ #endif
16
+
17
+ #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
18
+ #ifndef __stdcall
19
+ #define __stdcall
20
+ #endif
21
+ #ifndef __cdecl
22
+ #define __cdecl
23
+ #endif
24
+ #ifndef __fastcall
25
+ #define __fastcall
26
+ #endif
27
+ #endif
28
+
29
+ #ifndef DL_IMPORT
30
+ #define DL_IMPORT(t) t
31
+ #endif
32
+ #ifndef DL_EXPORT
33
+ #define DL_EXPORT(t) t
34
+ #endif
35
+
36
+ // For use in DL_IMPORT/DL_EXPORT macros.
37
+ #define __PYX_COMMA ,
38
+
39
+ #ifndef HAVE_LONG_LONG
40
+ // CPython has required PY_LONG_LONG support for years, even if HAVE_LONG_LONG is not defined for us
41
+ #define HAVE_LONG_LONG
42
+ #endif
43
+
44
+ #ifndef PY_LONG_LONG
45
+ #define PY_LONG_LONG LONG_LONG
46
+ #endif
47
+
48
+ #ifndef Py_HUGE_VAL
49
+ #define Py_HUGE_VAL HUGE_VAL
50
+ #endif
51
+
52
+ // For the limited API it often makes sense to use Py_LIMITED_API rather than PY_VERSION_HEX
53
+ // when doing version checks.
54
+ #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
55
+
56
+ #if defined(GRAALVM_PYTHON)
57
+ /* For very preliminary testing purposes. Most variables are set the same as PyPy.
58
+ The existence of this section does not imply that anything works or is even tested */
59
+ // GRAALVM_PYTHON test comes before PyPy test because GraalPython unhelpfully defines PYPY_VERSION
60
+ #define CYTHON_COMPILING_IN_PYPY 0
61
+ #define CYTHON_COMPILING_IN_CPYTHON 0
62
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
63
+ #define CYTHON_COMPILING_IN_GRAAL 1
64
+
65
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
66
+
67
+ #undef CYTHON_USE_TYPE_SLOTS
68
+ #define CYTHON_USE_TYPE_SLOTS 0
69
+ #undef CYTHON_USE_TYPE_SPECS
70
+ #define CYTHON_USE_TYPE_SPECS 0
71
+ #undef CYTHON_USE_PYTYPE_LOOKUP
72
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
73
+ #undef CYTHON_USE_PYLIST_INTERNALS
74
+ #define CYTHON_USE_PYLIST_INTERNALS 0
75
+ #undef CYTHON_USE_UNICODE_INTERNALS
76
+ #define CYTHON_USE_UNICODE_INTERNALS 0
77
+ #undef CYTHON_USE_UNICODE_WRITER
78
+ #define CYTHON_USE_UNICODE_WRITER 0
79
+ #undef CYTHON_USE_PYLONG_INTERNALS
80
+ #define CYTHON_USE_PYLONG_INTERNALS 0
81
+ #undef CYTHON_AVOID_BORROWED_REFS
82
+ #define CYTHON_AVOID_BORROWED_REFS 1
83
+ #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
84
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
85
+ #undef CYTHON_ASSUME_SAFE_MACROS
86
+ #define CYTHON_ASSUME_SAFE_MACROS 0
87
+ #undef CYTHON_ASSUME_SAFE_SIZE
88
+ #define CYTHON_ASSUME_SAFE_SIZE 0
89
+ #undef CYTHON_UNPACK_METHODS
90
+ #define CYTHON_UNPACK_METHODS 0
91
+ #undef CYTHON_FAST_THREAD_STATE
92
+ #define CYTHON_FAST_THREAD_STATE 0
93
+ #undef CYTHON_FAST_GIL
94
+ #define CYTHON_FAST_GIL 0
95
+ #undef CYTHON_METH_FASTCALL
96
+ #define CYTHON_METH_FASTCALL 0
97
+ #undef CYTHON_FAST_PYCALL
98
+ #define CYTHON_FAST_PYCALL 0
99
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
100
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
101
+ #endif
102
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
103
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
104
+ #undef CYTHON_USE_MODULE_STATE
105
+ #define CYTHON_USE_MODULE_STATE 0
106
+ #undef CYTHON_USE_SYS_MONITORING
107
+ #define CYTHON_USE_SYS_MONITORING 0
108
+ #undef CYTHON_USE_TP_FINALIZE
109
+ #define CYTHON_USE_TP_FINALIZE 0
110
+ #undef CYTHON_USE_AM_SEND
111
+ #define CYTHON_USE_AM_SEND 0
112
+ #undef CYTHON_USE_DICT_VERSIONS
113
+ #define CYTHON_USE_DICT_VERSIONS 0
114
+ #undef CYTHON_USE_EXC_INFO_STACK
115
+ #define CYTHON_USE_EXC_INFO_STACK 1
116
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
117
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
118
+ #endif
119
+ #undef CYTHON_USE_FREELISTS
120
+ #define CYTHON_USE_FREELISTS 0
121
+
122
+ #elif defined(PYPY_VERSION)
123
+ #define CYTHON_COMPILING_IN_PYPY 1
124
+ #define CYTHON_COMPILING_IN_CPYTHON 0
125
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
126
+ #define CYTHON_COMPILING_IN_GRAAL 0
127
+
128
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
129
+
130
+ #undef CYTHON_USE_TYPE_SLOTS
131
+ #define CYTHON_USE_TYPE_SLOTS 1
132
+ #ifndef CYTHON_USE_TYPE_SPECS
133
+ #define CYTHON_USE_TYPE_SPECS 0
134
+ #endif
135
+ #undef CYTHON_USE_PYTYPE_LOOKUP
136
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
137
+ #undef CYTHON_USE_PYLIST_INTERNALS
138
+ #define CYTHON_USE_PYLIST_INTERNALS 0
139
+ #undef CYTHON_USE_UNICODE_INTERNALS
140
+ #define CYTHON_USE_UNICODE_INTERNALS 0
141
+ #undef CYTHON_USE_UNICODE_WRITER
142
+ #define CYTHON_USE_UNICODE_WRITER 0
143
+ #undef CYTHON_USE_PYLONG_INTERNALS
144
+ #define CYTHON_USE_PYLONG_INTERNALS 0
145
+ #undef CYTHON_AVOID_BORROWED_REFS
146
+ #define CYTHON_AVOID_BORROWED_REFS 1
147
+ #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
148
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
149
+ #undef CYTHON_ASSUME_SAFE_MACROS
150
+ #define CYTHON_ASSUME_SAFE_MACROS 0
151
+ #ifndef CYTHON_ASSUME_SAFE_SIZE
152
+ #define CYTHON_ASSUME_SAFE_SIZE 1
153
+ #endif
154
+ #undef CYTHON_UNPACK_METHODS
155
+ #define CYTHON_UNPACK_METHODS 0
156
+ #undef CYTHON_FAST_THREAD_STATE
157
+ #define CYTHON_FAST_THREAD_STATE 0
158
+ #undef CYTHON_FAST_GIL
159
+ #define CYTHON_FAST_GIL 0
160
+ #undef CYTHON_METH_FASTCALL
161
+ #define CYTHON_METH_FASTCALL 0
162
+ #undef CYTHON_FAST_PYCALL
163
+ #define CYTHON_FAST_PYCALL 0
164
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
165
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
166
+ #endif
167
+ #if PY_VERSION_HEX < 0x03090000
168
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
169
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 0
170
+ #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
171
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
172
+ #endif
173
+ #undef CYTHON_USE_MODULE_STATE
174
+ #define CYTHON_USE_MODULE_STATE 0
175
+ #undef CYTHON_USE_SYS_MONITORING
176
+ #define CYTHON_USE_SYS_MONITORING 0
177
+ #ifndef CYTHON_USE_TP_FINALIZE
178
+ #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
179
+ #endif
180
+ #undef CYTHON_USE_AM_SEND
181
+ #define CYTHON_USE_AM_SEND 0
182
+ #undef CYTHON_USE_DICT_VERSIONS
183
+ #define CYTHON_USE_DICT_VERSIONS 0
184
+ #undef CYTHON_USE_EXC_INFO_STACK
185
+ #define CYTHON_USE_EXC_INFO_STACK 0
186
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
187
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
188
+ #endif
189
+ #undef CYTHON_USE_FREELISTS
190
+ #define CYTHON_USE_FREELISTS 0
191
+
192
+ #elif defined(CYTHON_LIMITED_API)
193
+ // EXPERIMENTAL !!
194
+ #ifdef Py_LIMITED_API
195
+ #undef __PYX_LIMITED_VERSION_HEX
196
+ #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
197
+ #endif
198
+ #define CYTHON_COMPILING_IN_PYPY 0
199
+ #define CYTHON_COMPILING_IN_CPYTHON 0
200
+ #define CYTHON_COMPILING_IN_LIMITED_API 1
201
+ #define CYTHON_COMPILING_IN_GRAAL 0
202
+
203
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
204
+
205
+ // CYTHON_CLINE_IN_TRACEBACK is currently disabled for the Limited API
206
+ #undef CYTHON_CLINE_IN_TRACEBACK
207
+ #define CYTHON_CLINE_IN_TRACEBACK 0
208
+
209
+ #undef CYTHON_USE_TYPE_SLOTS
210
+ #define CYTHON_USE_TYPE_SLOTS 0
211
+ #undef CYTHON_USE_TYPE_SPECS
212
+ #define CYTHON_USE_TYPE_SPECS 1
213
+ #undef CYTHON_USE_PYTYPE_LOOKUP
214
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
215
+ #undef CYTHON_USE_PYLIST_INTERNALS
216
+ #define CYTHON_USE_PYLIST_INTERNALS 0
217
+ #undef CYTHON_USE_UNICODE_INTERNALS
218
+ #define CYTHON_USE_UNICODE_INTERNALS 0
219
+ #ifndef CYTHON_USE_UNICODE_WRITER
220
+ #define CYTHON_USE_UNICODE_WRITER 0
221
+ #endif
222
+ #undef CYTHON_USE_PYLONG_INTERNALS
223
+ #define CYTHON_USE_PYLONG_INTERNALS 0
224
+ #ifndef CYTHON_AVOID_BORROWED_REFS
225
+ #define CYTHON_AVOID_BORROWED_REFS 0
226
+ #endif
227
+ #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
228
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
229
+ #endif
230
+ #undef CYTHON_ASSUME_SAFE_MACROS
231
+ #define CYTHON_ASSUME_SAFE_MACROS 0
232
+ #undef CYTHON_ASSUME_SAFE_SIZE
233
+ #define CYTHON_ASSUME_SAFE_SIZE 0
234
+ #undef CYTHON_UNPACK_METHODS
235
+ #define CYTHON_UNPACK_METHODS 0
236
+ #undef CYTHON_FAST_THREAD_STATE
237
+ #define CYTHON_FAST_THREAD_STATE 0
238
+ #undef CYTHON_FAST_GIL
239
+ #define CYTHON_FAST_GIL 0
240
+ #undef CYTHON_METH_FASTCALL
241
+ #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
242
+ #undef CYTHON_FAST_PYCALL
243
+ #define CYTHON_FAST_PYCALL 0
244
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
245
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
246
+ #endif
247
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
248
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 0
249
+ #ifndef CYTHON_USE_MODULE_STATE
250
+ #define CYTHON_USE_MODULE_STATE 1
251
+ #endif
252
+ #undef CYTHON_USE_SYS_MONITORING
253
+ #define CYTHON_USE_SYS_MONITORING 0
254
+ #ifndef CYTHON_USE_TP_FINALIZE
255
+ // PyObject_CallFinalizerFromDealloc is missing and not easily replaced
256
+ #define CYTHON_USE_TP_FINALIZE 0
257
+ #endif
258
+ #ifndef CYTHON_USE_AM_SEND
259
+ #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
260
+ #endif
261
+ #undef CYTHON_USE_DICT_VERSIONS
262
+ #define CYTHON_USE_DICT_VERSIONS 0
263
+ #undef CYTHON_USE_EXC_INFO_STACK
264
+ #define CYTHON_USE_EXC_INFO_STACK 0
265
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
266
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
267
+ #endif
268
+ #undef CYTHON_USE_FREELISTS
269
+ #define CYTHON_USE_FREELISTS 0
270
+
271
+ #else
272
+ #define CYTHON_COMPILING_IN_PYPY 0
273
+ #define CYTHON_COMPILING_IN_CPYTHON 1
274
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
275
+ #define CYTHON_COMPILING_IN_GRAAL 0
276
+
277
+ #ifdef Py_GIL_DISABLED
278
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
279
+ #else
280
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
281
+ #endif
282
+
283
+ #if PY_VERSION_HEX < 0x030A0000
284
+ // Before Py3.10, PyObject_GetSlot() rejects static (non-heap) types.
285
+ #undef CYTHON_USE_TYPE_SLOTS
286
+ #define CYTHON_USE_TYPE_SLOTS 1
287
+ #elif !defined(CYTHON_USE_TYPE_SLOTS)
288
+ #define CYTHON_USE_TYPE_SLOTS 1
289
+ #endif
290
+ #ifndef CYTHON_USE_TYPE_SPECS
291
+ #define CYTHON_USE_TYPE_SPECS 0
292
+ #endif
293
+ #ifndef CYTHON_USE_PYTYPE_LOOKUP
294
+ #define CYTHON_USE_PYTYPE_LOOKUP 1
295
+ #endif
296
+ #ifndef CYTHON_USE_PYLONG_INTERNALS
297
+ #define CYTHON_USE_PYLONG_INTERNALS 1
298
+ #endif
299
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
300
+ #undef CYTHON_USE_PYLIST_INTERNALS
301
+ // Use thread-safe CPython C API calls to manipulate list contents
302
+ #define CYTHON_USE_PYLIST_INTERNALS 0
303
+ #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
304
+ #define CYTHON_USE_PYLIST_INTERNALS 1
305
+ #endif
306
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
307
+ #define CYTHON_USE_UNICODE_INTERNALS 1
308
+ #endif
309
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
310
+ // Python 3.11a2 hid _PyLong_FormatAdvancedWriter and _PyFloat_FormatAdvancedWriter
311
+ // therefore disable unicode writer until a better alternative appears
312
+ #undef CYTHON_USE_UNICODE_WRITER
313
+ #define CYTHON_USE_UNICODE_WRITER 0
314
+ #elif !defined(CYTHON_USE_UNICODE_WRITER)
315
+ #define CYTHON_USE_UNICODE_WRITER 1
316
+ #endif
317
+ // CYTHON_AVOID_BORROWED_REFS - Avoid borrowed references and always request owned references directly instead.
318
+ #ifndef CYTHON_AVOID_BORROWED_REFS
319
+ #define CYTHON_AVOID_BORROWED_REFS 0
320
+ #endif
321
+ // CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS - Avoid borrowed references that are not thread-safe in the free-threaded build of CPython.
322
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
323
+ #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
324
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
325
+ #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
326
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
327
+ #endif
328
+ // CYTHON_ASSUME_SAFE_MACROS - Assume that macro calls do not fail and do not raise exceptions.
329
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
330
+ #define CYTHON_ASSUME_SAFE_MACROS 1
331
+ #endif
332
+ // CYTHON_ASSUME_SAFE_SIZE - Assume that Py*_GET_SIZE() calls do not fail and do not raise exceptions.
333
+ #ifndef CYTHON_ASSUME_SAFE_SIZE
334
+ #define CYTHON_ASSUME_SAFE_SIZE 1
335
+ #endif
336
+ #ifndef CYTHON_UNPACK_METHODS
337
+ #define CYTHON_UNPACK_METHODS 1
338
+ #endif
339
+ #ifndef CYTHON_FAST_THREAD_STATE
340
+ #define CYTHON_FAST_THREAD_STATE 1
341
+ #endif
342
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
343
+ #undef CYTHON_FAST_GIL
344
+ #define CYTHON_FAST_GIL 0
345
+ #elif !defined(CYTHON_FAST_GIL)
346
+ // FIXME: FastGIL can probably be supported also in CPython 3.12 but needs to be adapted.
347
+ // The gain is unclear, however, since the GIL handling itself became faster in recent CPython versions.
348
+ #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
349
+ #endif
350
+ #ifndef CYTHON_METH_FASTCALL
351
+ // CPython 3.6 introduced METH_FASTCALL but with slightly different
352
+ // semantics. It became stable starting from CPython 3.7.
353
+ #define CYTHON_METH_FASTCALL 1
354
+ #endif
355
+ #ifndef CYTHON_FAST_PYCALL
356
+ #define CYTHON_FAST_PYCALL 1
357
+ #endif
358
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
359
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
360
+ #endif
361
+ #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
362
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
363
+ #endif
364
+ // CYTHON_USE_MODULE_STATE - Use a module state/globals struct tied to the module object.
365
+ #ifndef CYTHON_USE_MODULE_STATE
366
+ // EXPERIMENTAL !!
367
+ #define CYTHON_USE_MODULE_STATE 0
368
+ #endif
369
+ #ifndef CYTHON_USE_SYS_MONITORING
370
+ #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
371
+ #endif
372
+ #ifndef CYTHON_USE_TP_FINALIZE
373
+ #define CYTHON_USE_TP_FINALIZE 1
374
+ #endif
375
+ #ifndef CYTHON_USE_AM_SEND
376
+ #define CYTHON_USE_AM_SEND 1
377
+ #endif
378
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
379
+ #undef CYTHON_USE_DICT_VERSIONS
380
+ #define CYTHON_USE_DICT_VERSIONS 0
381
+ #elif !defined(CYTHON_USE_DICT_VERSIONS)
382
+ // Python 3.12a5 deprecated "ma_version_tag"
383
+ // and we use static variables with dict versions so it's incompatible with module state
384
+ #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
385
+ #endif
386
+ #ifndef CYTHON_USE_EXC_INFO_STACK
387
+ #define CYTHON_USE_EXC_INFO_STACK 1
388
+ #endif
389
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
390
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
391
+ #endif
392
+ #ifndef CYTHON_USE_FREELISTS
393
+ #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
394
+ #endif
395
+ #endif
396
+
397
+ #ifndef CYTHON_FAST_PYCCALL
398
+ #define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL
399
+ #endif
400
+
401
+ #ifndef CYTHON_VECTORCALL
402
+ #if CYTHON_COMPILING_IN_LIMITED_API
403
+ // Possibly needs a bit of clearing up, however:
404
+ // the limited API doesn't define CYTHON_FAST_PYCCALL (because that involves
405
+ // a lot of access to internals) but does define CYTHON_VECTORCALL because
406
+ // that's available cleanly from Python 3.12. Note that only VectorcallDict isn't
407
+ // available though.
408
+ #define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
409
+ #else
410
+ #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
411
+ #endif
412
+ #endif
413
+
414
+ /* Whether to use METH_FASTCALL with a fake backported implementation of vectorcall */
415
+ #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
416
+
417
+ #if CYTHON_USE_PYLONG_INTERNALS
418
+ /* These short defines from the PyLong header can easily conflict with other code */
419
+ #undef SHIFT
420
+ #undef BASE
421
+ #undef MASK
422
+ /* Compile-time sanity check that these are indeed equal. Github issue #2670. */
423
+ #ifdef SIZEOF_VOID_P
424
+ enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
425
+ #endif
426
+ #endif
427
+
428
+ #ifndef __has_attribute
429
+ #define __has_attribute(x) 0
430
+ #endif
431
+
432
+ #ifndef __has_cpp_attribute
433
+ #define __has_cpp_attribute(x) 0
434
+ #endif
435
+
436
+ // restrict
437
+ #ifndef CYTHON_RESTRICT
438
+ #if defined(__GNUC__)
439
+ #define CYTHON_RESTRICT __restrict__
440
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
441
+ #define CYTHON_RESTRICT __restrict
442
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
443
+ #define CYTHON_RESTRICT restrict
444
+ #else
445
+ #define CYTHON_RESTRICT
446
+ #endif
447
+ #endif
448
+
449
+ // unused attribute
450
+ #ifndef CYTHON_UNUSED
451
+ #if defined(__cplusplus)
452
+ /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
453
+ * but leads to warnings with -pedantic, since it is a C++17 feature */
454
+ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
455
+ #if __has_cpp_attribute(maybe_unused)
456
+ #define CYTHON_UNUSED [[maybe_unused]]
457
+ #endif
458
+ #endif
459
+ #endif
460
+ #endif
461
+ #ifndef CYTHON_UNUSED
462
+ # if defined(__GNUC__)
463
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
464
+ # define CYTHON_UNUSED __attribute__ ((__unused__))
465
+ # else
466
+ # define CYTHON_UNUSED
467
+ # endif
468
+ # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
469
+ # define CYTHON_UNUSED __attribute__ ((__unused__))
470
+ # else
471
+ # define CYTHON_UNUSED
472
+ # endif
473
+ #endif
474
+
475
+ #ifndef CYTHON_UNUSED_VAR
476
+ # if defined(__cplusplus)
477
+ template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
478
+ # else
479
+ # define CYTHON_UNUSED_VAR(x) (void)(x)
480
+ # endif
481
+ #endif
482
+
483
+ #ifndef CYTHON_MAYBE_UNUSED_VAR
484
+ #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
485
+ #endif
486
+
487
+ #ifndef CYTHON_NCP_UNUSED
488
+ # if CYTHON_COMPILING_IN_CPYTHON
489
+ # define CYTHON_NCP_UNUSED
490
+ # else
491
+ # define CYTHON_NCP_UNUSED CYTHON_UNUSED
492
+ # endif
493
+ #endif
494
+
495
+ #ifndef CYTHON_USE_CPP_STD_MOVE
496
+ // msvc doesn't set __cplusplus to a useful value
497
+ #if defined(__cplusplus) && ( \
498
+ __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
499
+ #define CYTHON_USE_CPP_STD_MOVE 1
500
+ #else
501
+ #define CYTHON_USE_CPP_STD_MOVE 0
502
+ #endif
503
+ #endif
504
+
505
+ #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
506
+
507
+ #ifdef _MSC_VER
508
+ #ifndef _MSC_STDINT_H_
509
+ #if _MSC_VER < 1300
510
+ typedef unsigned char uint8_t;
511
+ typedef unsigned short uint16_t;
512
+ typedef unsigned int uint32_t;
513
+ #else
514
+ typedef unsigned __int8 uint8_t;
515
+ typedef unsigned __int16 uint16_t;
516
+ typedef unsigned __int32 uint32_t;
517
+ #endif
518
+ #endif
519
+ #if _MSC_VER < 1300
520
+ #ifdef _WIN64
521
+ typedef unsigned long long __pyx_uintptr_t;
522
+ #else
523
+ typedef unsigned int __pyx_uintptr_t;
524
+ #endif
525
+ #else
526
+ #ifdef _WIN64
527
+ typedef unsigned __int64 __pyx_uintptr_t;
528
+ #else
529
+ typedef unsigned __int32 __pyx_uintptr_t;
530
+ #endif
531
+ #endif
532
+ #else
533
+ #include <stdint.h>
534
+ typedef uintptr_t __pyx_uintptr_t;
535
+ #endif
536
+
537
+
538
+ #ifndef CYTHON_FALLTHROUGH
539
+ #if defined(__cplusplus)
540
+ /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
541
+ * but leads to warnings with -pedantic, since it is a C++17 feature */
542
+ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
543
+ #if __has_cpp_attribute(fallthrough)
544
+ #define CYTHON_FALLTHROUGH [[fallthrough]]
545
+ #endif
546
+ #endif
547
+
548
+ #ifndef CYTHON_FALLTHROUGH
549
+ #if __has_cpp_attribute(clang::fallthrough)
550
+ #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
551
+ #elif __has_cpp_attribute(gnu::fallthrough)
552
+ #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
553
+ #endif
554
+ #endif
555
+ #endif
556
+
557
+ #ifndef CYTHON_FALLTHROUGH
558
+ #if __has_attribute(fallthrough)
559
+ #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
560
+ #else
561
+ #define CYTHON_FALLTHROUGH
562
+ #endif
563
+ #endif
564
+
565
+ #if defined(__clang__) && defined(__apple_build_version__)
566
+ #if __apple_build_version__ < 7000000 /* Xcode < 7.0 */
567
+ #undef CYTHON_FALLTHROUGH
568
+ #define CYTHON_FALLTHROUGH
569
+ #endif
570
+ #endif
571
+ #endif
572
+
573
+ #ifndef Py_UNREACHABLE
574
+ #define Py_UNREACHABLE() assert(0); abort()
575
+ #endif
576
+
577
+ #ifdef __cplusplus
578
+ template <typename T>
579
+ struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
580
+ #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
581
+ #else
582
+ #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
583
+ #endif
584
+
585
+ #if CYTHON_COMPILING_IN_PYPY == 1
586
+ #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
587
+ #else
588
+ #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
589
+ #endif
590
+ // reinterpret
591
+
592
+ // TODO: refactor existing code to use those macros
593
+ #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
594
+ // #define __PYX_REINTERPRET_POINTER(pointer_type, pointer) ((pointer_type)(void *)(pointer))
595
+ // #define __PYX_RUNTIME_REINTERPRET(type, var) (*(type *)(&var))
596
+
597
+
598
+ /////////////// CInitCode ///////////////
599
+
600
+ // inline attribute
601
+ #ifndef CYTHON_INLINE
602
+ #if defined(__clang__)
603
+ #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
604
+ #elif defined(__GNUC__)
605
+ #define CYTHON_INLINE __inline__
606
+ #elif defined(_MSC_VER)
607
+ #define CYTHON_INLINE __inline
608
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
609
+ #define CYTHON_INLINE inline
610
+ #else
611
+ #define CYTHON_INLINE
612
+ #endif
613
+ #endif
614
+
615
+
616
+ /////////////// CppInitCode ///////////////
617
+
618
+ #ifndef __cplusplus
619
+ #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
620
+ #endif
621
+
622
+ // inline attribute
623
+ #ifndef CYTHON_INLINE
624
+ #if defined(__clang__)
625
+ #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
626
+ #else
627
+ #define CYTHON_INLINE inline
628
+ #endif
629
+ #endif
630
+
631
+ // Work around clang bug https://stackoverflow.com/questions/21847816/c-invoke-nested-template-class-destructor
632
+ template<typename T>
633
+ void __Pyx_call_destructor(T& x) {
634
+ x.~T();
635
+ }
636
+
637
+ // Used for temporary variables of "reference" type.
638
+ template<typename T>
639
+ class __Pyx_FakeReference {
640
+ public:
641
+ __Pyx_FakeReference() : ptr(NULL) { }
642
+ // __Pyx_FakeReference(T& ref) : ptr(&ref) { }
643
+ // Const version needed as Cython doesn't know about const overloads (e.g. for stl containers).
644
+ __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
645
+ T *operator->() { return ptr; }
646
+ T *operator&() { return ptr; }
647
+ operator T&() { return *ptr; }
648
+ // TODO(robertwb): Delegate all operators (or auto-generate unwrapping code where needed).
649
+ template<typename U> bool operator ==(const U& other) const { return *ptr == other; }
650
+ template<typename U> bool operator !=(const U& other) const { return *ptr != other; }
651
+ template<typename U> bool operator==(const __Pyx_FakeReference<U>& other) const { return *ptr == *other.ptr; }
652
+ template<typename U> bool operator!=(const __Pyx_FakeReference<U>& other) const { return *ptr != *other.ptr; }
653
+ private:
654
+ T *ptr;
655
+ };
656
+
657
+
658
+ /////////////// PythonCompatibility ///////////////
659
+ //@substitute: naming
660
+
661
+ #define __PYX_BUILD_PY_SSIZE_T "n"
662
+ #define CYTHON_FORMAT_SSIZE_T "z"
663
+
664
+ // TODO: remove this block
665
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
666
+ #define __Pyx_DefaultClassType PyType_Type
667
+
668
+ #if CYTHON_COMPILING_IN_LIMITED_API
669
+ // Cython uses these constants but they are not available in the limited API.
670
+ // (it'd be nice if there was a more robust way of looking these up)
671
+ #ifndef CO_OPTIMIZED
672
+ #define CO_OPTIMIZED 0x0001
673
+ #endif
674
+ #ifndef CO_NEWLOCALS
675
+ #define CO_NEWLOCALS 0x0002
676
+ #endif
677
+ #ifndef CO_VARARGS
678
+ #define CO_VARARGS 0x0004
679
+ #endif
680
+ #ifndef CO_VARKEYWORDS
681
+ #define CO_VARKEYWORDS 0x0008
682
+ #endif
683
+ #ifndef CO_ASYNC_GENERATOR
684
+ #define CO_ASYNC_GENERATOR 0x0200
685
+ #endif
686
+ #ifndef CO_GENERATOR
687
+ #define CO_GENERATOR 0x0020
688
+ #endif
689
+ #ifndef CO_COROUTINE
690
+ #define CO_COROUTINE 0x0080
691
+ #endif
692
+ #endif
693
+
694
+ #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
695
+ #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
696
+ #else
697
+ #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
698
+ #endif
699
+
700
+ #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
701
+ #define __Pyx_Py_Is(x, y) Py_Is(x, y)
702
+ #else
703
+ #define __Pyx_Py_Is(x, y) ((x) == (y))
704
+ #endif
705
+ #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
706
+ #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
707
+ #else
708
+ #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
709
+ #endif
710
+ #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
711
+ #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
712
+ #else
713
+ #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
714
+ #endif
715
+ #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
716
+ #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
717
+ #else
718
+ #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
719
+ #endif
720
+ #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
721
+
722
+ #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
723
+ #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
724
+ #else
725
+ #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
726
+ #endif
727
+
728
+ #ifndef CO_COROUTINE
729
+ #define CO_COROUTINE 0x80
730
+ #endif
731
+ #ifndef CO_ASYNC_GENERATOR
732
+ #define CO_ASYNC_GENERATOR 0x200
733
+ #endif
734
+
735
+ #ifndef Py_TPFLAGS_CHECKTYPES
736
+ #define Py_TPFLAGS_CHECKTYPES 0
737
+ #endif
738
+ #ifndef Py_TPFLAGS_HAVE_INDEX
739
+ #define Py_TPFLAGS_HAVE_INDEX 0
740
+ #endif
741
+ #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
742
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
743
+ #endif
744
+ #ifndef Py_TPFLAGS_HAVE_FINALIZE
745
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
746
+ #endif
747
+ #ifndef Py_TPFLAGS_SEQUENCE
748
+ #define Py_TPFLAGS_SEQUENCE 0
749
+ #endif
750
+ #ifndef Py_TPFLAGS_MAPPING
751
+ #define Py_TPFLAGS_MAPPING 0
752
+ #endif
753
+
754
+ #ifndef METH_STACKLESS
755
+ // already defined for Stackless Python (all versions) and C-Python >= 3.7
756
+ // value if defined: Stackless Python < 3.6: 0x80 else 0x100
757
+ #define METH_STACKLESS 0
758
+ #endif
759
+ #ifndef METH_FASTCALL
760
+ // new in CPython 3.6, but changed in 3.7 - see
761
+ // positional-only parameters:
762
+ // https://bugs.python.org/issue29464
763
+ // const args:
764
+ // https://bugs.python.org/issue32240
765
+ #ifndef METH_FASTCALL
766
+ #define METH_FASTCALL 0x80
767
+ #endif
768
+ typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
769
+ // new in CPython 3.7, used to be old signature of _PyCFunctionFast() in 3.6
770
+ typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
771
+ Py_ssize_t nargs, PyObject *kwnames);
772
+ #else
773
+ #if PY_VERSION_HEX >= 0x030d00A4
774
+ # define __Pyx_PyCFunctionFast PyCFunctionFast
775
+ # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
776
+ #else
777
+ # define __Pyx_PyCFunctionFast _PyCFunctionFast
778
+ # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
779
+ #endif
780
+ #endif
781
+
782
+ #if CYTHON_METH_FASTCALL
783
+ #define __Pyx_METH_FASTCALL METH_FASTCALL
784
+ #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
785
+ #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
786
+ #else
787
+ #define __Pyx_METH_FASTCALL METH_VARARGS
788
+ #define __Pyx_PyCFunction_FastCall PyCFunction
789
+ #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
790
+ #endif
791
+
792
+ #if CYTHON_VECTORCALL
793
+ #define __pyx_vectorcallfunc vectorcallfunc
794
+ #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
795
+ #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
796
+ #elif CYTHON_BACKPORT_VECTORCALL
797
+ typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
798
+ size_t nargsf, PyObject *kwnames);
799
+ #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
800
+ #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
801
+ #else
802
+ #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
803
+ #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
804
+ #endif
805
+
806
+ // These PyCFunction related macros get redefined in CythonFunction.c.
807
+ // We need our own copies because the inline functions in CPython have a type-check assert
808
+ // that breaks with a CyFunction in debug mode.
809
+ #if PY_VERSION_HEX >= 0x030900B1
810
+ #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
811
+ #else
812
+ #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
813
+ #endif
814
+ #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
815
+
816
+ #if CYTHON_COMPILING_IN_CPYTHON
817
+ #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
818
+ #elif !CYTHON_COMPILING_IN_LIMITED_API
819
+ // It's probably easier for non-CPythons to support PyCFunction_GET_FUNCTION() than the object struct layout.
820
+ #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
821
+ // Unused in CYTHON_COMPILING_IN_LIMITED_API.
822
+ #endif
823
+ #if CYTHON_COMPILING_IN_CPYTHON
824
+ #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
825
+ static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
826
+ return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
827
+ }
828
+ // Only used if CYTHON_COMPILING_IN_CPYTHON.
829
+ #endif
830
+ static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
831
+ #if CYTHON_COMPILING_IN_LIMITED_API
832
+ return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
833
+ #else
834
+ return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
835
+ #endif
836
+ }
837
+ #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
838
+
839
+ // PEP-573: PyCFunction holds reference to defining class (PyCMethodObject)
840
+ #if __PYX_LIMITED_VERSION_HEX < 0x030900B1
841
+ #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
842
+ typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
843
+ #else
844
+ #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
845
+ #define __Pyx_PyCMethod PyCMethod
846
+ #endif
847
+ #ifndef METH_METHOD
848
+ #define METH_METHOD 0x200
849
+ #endif
850
+
851
+ #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
852
+ #define PyObject_Malloc(s) PyMem_Malloc(s)
853
+ #define PyObject_Free(p) PyMem_Free(p)
854
+ #define PyObject_Realloc(p) PyMem_Realloc(p)
855
+ #endif
856
+
857
+ #if CYTHON_COMPILING_IN_LIMITED_API
858
+ // __Pyx_PyCode_HasFreeVars isn't easily emulated in the limited API (but isn't really necessary)
859
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
860
+ #elif CYTHON_COMPILING_IN_GRAAL
861
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
862
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
863
+ #else
864
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
865
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
866
+ #endif
867
+
868
+ #if CYTHON_COMPILING_IN_LIMITED_API
869
+ #define __Pyx_PyThreadState_Current PyThreadState_Get()
870
+ #elif !CYTHON_FAST_THREAD_STATE
871
+ #define __Pyx_PyThreadState_Current PyThreadState_GET()
872
+ #elif PY_VERSION_HEX >= 0x030d00A1
873
+ #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
874
+ #else
875
+ #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
876
+ #endif
877
+
878
+ #if CYTHON_USE_MODULE_STATE
879
+ static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
880
+ {
881
+ void *result;
882
+
883
+ result = PyModule_GetState(op);
884
+ if (!result)
885
+ Py_FatalError("Couldn't find the module state");
886
+ return result;
887
+ }
888
+ // Define a macro with a cast because the modulestate type isn't known yet and
889
+ // is a typedef struct so impossible to forward declare
890
+ #define __Pyx_PyModule_GetState(o) ($modulestatetype_cname *)__Pyx__PyModule_GetState(o)
891
+ #else
892
+ #define __Pyx_PyModule_GetState(op) ((void)op,$modulestateglobal_cname)
893
+ #endif
894
+
895
+ // The "Try" variants may return NULL on static types with the Limited API on earlier versions
896
+ // so should be used for optimization rather than where a result is required.
897
+ #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
898
+ #define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
899
+ #define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
900
+ #if CYTHON_USE_TYPE_SLOTS
901
+ #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
902
+ #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
903
+ #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
904
+ #else
905
+ #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
906
+ #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) \
907
+ ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 || \
908
+ (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ? \
909
+ __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
910
+ #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
911
+ #endif
912
+
913
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
914
+ #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
915
+ #else
916
+ #define __Pyx_PyDict_NewPresized(n) PyDict_New()
917
+ #endif
918
+
919
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
920
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
921
+
922
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
923
+ // _PyDict_GetItem_KnownHash() existed from CPython 3.5 to 3.12, but it was
924
+ // dropping exceptions in 3.5. Since 3.6, exceptions are kept.
925
+ #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
926
+ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
927
+ PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
928
+ if (res == NULL) PyErr_Clear();
929
+ return res;
930
+ }
931
+ #elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
932
+ #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
933
+ #define __Pyx_PyDict_GetItemStr PyDict_GetItem
934
+ #else
935
+ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
936
+ // This is tricky - we should return a borrowed reference but not swallow non-KeyError exceptions. 8-|
937
+ // But: this function is only used in Py2 and older PyPys,
938
+ // and currently only for argument parsing and other non-correctness-critical lookups
939
+ // and we know that 'name' is an interned 'str' with pre-calculated hash value (only comparisons can fail),
940
+ // thus, performance matters more than correctness here, especially in the "not found" case.
941
+ #if CYTHON_COMPILING_IN_PYPY
942
+ // So we ignore any exceptions in old PyPys ...
943
+ return PyDict_GetItem(dict, name);
944
+ #else
945
+ // and hack together a stripped-down and modified PyDict_GetItem() in CPython 2.
946
+ PyDictEntry *ep;
947
+ PyDictObject *mp = (PyDictObject*) dict;
948
+ long hash = ((PyStringObject *) name)->ob_shash;
949
+ assert(hash != -1); /* hash values of interned strings are always initialised */
950
+ ep = (mp->ma_lookup)(mp, name, hash);
951
+ if (ep == NULL) {
952
+ // error occurred
953
+ return NULL;
954
+ }
955
+ // found or not found
956
+ return ep->me_value;
957
+ #endif
958
+ }
959
+ #define __Pyx_PyDict_GetItemStr PyDict_GetItem
960
+ #endif
961
+
962
+ /* Type slots */
963
+
964
+ #if CYTHON_USE_TYPE_SLOTS
965
+ #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
966
+ #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
967
+ #else
968
+ #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
969
+ #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
970
+ #endif
971
+
972
+ // There is no replacement for "Py_TYPE(obj)->iternext" in the C-API.
973
+ // PyIter_Next() discards the StopIteration, unlike Python's "next()".
974
+ #define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
975
+
976
+ #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
977
+ // In Py3.8+, instances of heap types need to decref their type on deallocation.
978
+ // https://bugs.python.org/issue35810
979
+ #define __Pyx_PyHeapTypeObject_GC_Del(obj) { \
980
+ PyTypeObject *type = Py_TYPE((PyObject*)obj); \
981
+ assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)); \
982
+ PyObject_GC_Del(obj); \
983
+ Py_DECREF(type); \
984
+ }
985
+ #else
986
+ #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
987
+ #endif
988
+
989
+ #if CYTHON_COMPILING_IN_LIMITED_API
990
+ #define __Pyx_PyUnicode_READY(op) (0)
991
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
992
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
993
+ #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
994
+ // __Pyx_PyUnicode_DATA() and __Pyx_PyUnicode_READ() must go together, e.g. for iteration.
995
+ #define __Pyx_PyUnicode_DATA(u) ((void*)u)
996
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
997
+ //#define __Pyx_PyUnicode_WRITE(k, d, i, ch) /* not available */
998
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
999
+ #else
1000
+ #if PY_VERSION_HEX >= 0x030C0000
1001
+ // Py3.12 / PEP-623 removed wstr type unicode strings and all of the PyUnicode_READY() machinery.
1002
+ #define __Pyx_PyUnicode_READY(op) (0)
1003
+ #else
1004
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
1005
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
1006
+ #endif
1007
+
1008
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
1009
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
1010
+ #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
1011
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
1012
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
1013
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
1014
+ #if PY_VERSION_HEX >= 0x030C0000
1015
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
1016
+ #else
1017
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
1018
+ // Avoid calling deprecated C-API functions in Py3.9+ that PEP-623 schedules for removal in Py3.12.
1019
+ // https://www.python.org/dev/peps/pep-0623/
1020
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
1021
+ #else
1022
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
1023
+ #endif
1024
+ #endif
1025
+ #endif
1026
+
1027
+ #if CYTHON_COMPILING_IN_PYPY
1028
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
1029
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
1030
+ #else
1031
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
1032
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
1033
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
1034
+ #endif
1035
+
1036
+ #if CYTHON_COMPILING_IN_PYPY
1037
+ #if !defined(PyUnicode_DecodeUnicodeEscape)
1038
+ #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
1039
+ #endif
1040
+ #if !defined(PyUnicode_Contains)
1041
+ #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
1042
+ #endif
1043
+ #if !defined(PyByteArray_Check)
1044
+ #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
1045
+ #endif
1046
+ #if !defined(PyObject_Format)
1047
+ #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
1048
+ #endif
1049
+ #endif
1050
+
1051
+ // ("..." % x) must call PyNumber_Remainder() if x is a string subclass that implements "__rmod__()".
1052
+ #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
1053
+
1054
+ #if CYTHON_COMPILING_IN_CPYTHON
1055
+ #define __Pyx_PySequence_ListKeepNew(obj) \
1056
+ (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
1057
+ #else
1058
+ #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
1059
+ #endif
1060
+
1061
+ #ifndef PySet_CheckExact
1062
+ #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
1063
+ #endif
1064
+
1065
+ #if PY_VERSION_HEX >= 0x030900A4
1066
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
1067
+ #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
1068
+ #else
1069
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
1070
+ #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
1071
+ #endif
1072
+
1073
+ #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && PY_VERSION_HEX >= 0x030d00b1
1074
+ #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
1075
+ #define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
1076
+ #elif !CYTHON_AVOID_BORROWED_REFS
1077
+
1078
+ #if CYTHON_ASSUME_SAFE_MACROS
1079
+ #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
1080
+ #else
1081
+ #define __Pyx_PyList_GetItemRef(o, i) PySequence_GetItem(o, i)
1082
+ #endif
1083
+
1084
+ static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
1085
+ *result = PyDict_GetItem(dict, key);
1086
+ if (*result == NULL) {
1087
+ return 0;
1088
+ }
1089
+ Py_INCREF(*result);
1090
+ return 1;
1091
+ }
1092
+ #else
1093
+ #define __Pyx_PyList_GetItemRef(o, i) PySequence_GetItem(o, i)
1094
+ static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
1095
+ *result = PyObject_GetItem(dict, key);
1096
+ if (PyErr_Occurred()) {
1097
+ return -1;
1098
+ } else if (*result == NULL) {
1099
+ return 0;
1100
+ }
1101
+ return 1;
1102
+ }
1103
+ #endif
1104
+
1105
+ // No-op macro for calling Py_VISIT() on known constants that can never participate in reference cycles.
1106
+ // Users can define "CYTHON_DEBUG_VISIT_CONST=1" to help in debugging reference issues.
1107
+ #if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
1108
+ #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj)
1109
+ #else
1110
+ #define __Pyx_VISIT_CONST(obj)
1111
+ #endif
1112
+
1113
+ #if CYTHON_ASSUME_SAFE_MACROS
1114
+ #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
1115
+ #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
1116
+ #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
1117
+ #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
1118
+ #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
1119
+ #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
1120
+ #else
1121
+ #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
1122
+ // NOTE: might fail with exception => check for -1
1123
+ #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
1124
+ // NOTE: this doesn't leak a reference to whatever is at o[i]
1125
+ #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
1126
+ #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
1127
+ #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
1128
+ #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
1129
+ #endif
1130
+
1131
+ #if CYTHON_ASSUME_SAFE_SIZE
1132
+ #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
1133
+ #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
1134
+ #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
1135
+ #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
1136
+ #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
1137
+ #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
1138
+ #else
1139
+ // These all need exception checks for -1.
1140
+ #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
1141
+ #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
1142
+ #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
1143
+ #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
1144
+ #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
1145
+ #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
1146
+ #endif
1147
+
1148
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
1149
+ #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
1150
+ #else
1151
+ static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
1152
+ PyObject *module = PyImport_AddModule(name);
1153
+ Py_XINCREF(module);
1154
+ return module;
1155
+ }
1156
+ #endif
1157
+
1158
+ // TODO: remove
1159
+ #define PyBoolObject PyLongObject
1160
+
1161
+ #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
1162
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
1163
+ #endif
1164
+
1165
+ #define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
1166
+ #define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t
1167
+
1168
+
1169
+ // backport of PyAsyncMethods from Py3.10 to older Py3.x versions
1170
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
1171
+ #define __Pyx_PySendResult PySendResult
1172
+ #else
1173
+ typedef enum {
1174
+ PYGEN_RETURN = 0,
1175
+ PYGEN_ERROR = -1,
1176
+ PYGEN_NEXT = 1,
1177
+ } __Pyx_PySendResult;
1178
+ #endif
1179
+
1180
+ #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
1181
+ typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
1182
+ #else
1183
+ #define __Pyx_pyiter_sendfunc sendfunc
1184
+ #endif
1185
+
1186
+ // "Py_am_send" requires Py3.10 when using type specs.
1187
+ #define __PYX_HAS_PY_AM_SEND (!CYTHON_USE_TYPE_SPECS || CYTHON_USE_AM_SEND && __PYX_LIMITED_VERSION_HEX >= 0x030A0000)
1188
+
1189
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
1190
+ #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
1191
+ #define __Pyx_SlotTpAsAsync(s) (&(s))
1192
+ #else
1193
+ // PyAsyncMethods in Py<3.10 lacks "am_send"
1194
+ typedef struct {
1195
+ unaryfunc am_await;
1196
+ unaryfunc am_aiter;
1197
+ unaryfunc am_anext;
1198
+ __Pyx_pyiter_sendfunc am_send;
1199
+ } __Pyx_PyAsyncMethodsStruct;
1200
+
1201
+ #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)&(s))
1202
+ #endif
1203
+
1204
+ // Use a flag in Py < 3.10 to mark coroutines that have the "am_send" field.
1205
+ #if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
1206
+ #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
1207
+ #else
1208
+ #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
1209
+ #endif
1210
+
1211
+
1212
+ /////////////// CythonABIVersion.proto ///////////////
1213
+ //@proto_block: module_declarations
1214
+ // This needs to go after the utility code 'proto' section but before user code and utility impl.
1215
+
1216
+ #if CYTHON_COMPILING_IN_LIMITED_API
1217
+ // The limited API makes some significant changes to data structures, so we don't
1218
+ // want to share the implementations compiled with and without the limited API.
1219
+ #define __PYX_LIMITED_ABI_SUFFIX "limited"
1220
+ #else
1221
+ #define __PYX_LIMITED_ABI_SUFFIX
1222
+ #endif
1223
+
1224
+ #ifndef __PYX_MONITORING_ABI_SUFFIX
1225
+ #define __PYX_MONITORING_ABI_SUFFIX
1226
+ #endif
1227
+
1228
+ #if CYTHON_USE_TP_FINALIZE
1229
+ #define __PYX_TP_FINALIZE_ABI_SUFFIX
1230
+ #else
1231
+ // affects destruction of async generator/coroutines
1232
+ #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
1233
+ #endif
1234
+
1235
+ #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
1236
+ #define __PYX_FREELISTS_ABI_SUFFIX
1237
+ #else
1238
+ // affects allocation/deallocation of async generator objects.
1239
+ #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
1240
+ #endif
1241
+
1242
+ #define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX
1243
+
1244
+ #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
1245
+ #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
1246
+
1247
+
1248
+ /////////////// IncludeStructmemberH.proto ///////////////
1249
+ //@proto_block: utility_code_proto_before_types
1250
+
1251
+ #include <structmember.h>
1252
+
1253
+
1254
+ /////////////// SmallCodeConfig ///////////////
1255
+
1256
+ #ifndef CYTHON_SMALL_CODE
1257
+ #if defined(__clang__)
1258
+ #define CYTHON_SMALL_CODE
1259
+ #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
1260
+ #define CYTHON_SMALL_CODE __attribute__((cold))
1261
+ #else
1262
+ #define CYTHON_SMALL_CODE
1263
+ #endif
1264
+ #endif
1265
+
1266
+
1267
+ /////////////// PyModInitFuncType ///////////////
1268
+
1269
+ #ifndef CYTHON_NO_PYINIT_EXPORT
1270
+ #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
1271
+ #else
1272
+ // define this to PyObject * manually because PyMODINIT_FUNC adds __declspec(dllexport) to it's definition.
1273
+ #ifdef __cplusplus
1274
+ #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
1275
+ #else
1276
+ #define __Pyx_PyMODINIT_FUNC PyObject *
1277
+ #endif
1278
+ #endif
1279
+
1280
+
1281
+ /////////////// FastTypeChecks.proto ///////////////
1282
+
1283
+ #if CYTHON_COMPILING_IN_CPYTHON
1284
+ #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1285
+ #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
1286
+ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);/*proto*/
1287
+ static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);/*proto*/
1288
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);/*proto*/
1289
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);/*proto*/
1290
+ #else
1291
+ #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1292
+ #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
1293
+ #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1294
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
1295
+ return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
1296
+ }
1297
+ #endif
1298
+ #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
1299
+
1300
+ #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1301
+ #ifdef PyExceptionInstance_Check
1302
+ #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
1303
+ #else
1304
+ #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
1305
+ #endif
1306
+
1307
+
1308
+ /////////////// FastTypeChecks ///////////////
1309
+ //@requires: Exceptions.c::PyThreadStateGet
1310
+ //@requires: Exceptions.c::PyErrFetchRestore
1311
+
1312
+ #if CYTHON_COMPILING_IN_CPYTHON
1313
+ static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
1314
+ while (a) {
1315
+ a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
1316
+ if (a == b)
1317
+ return 1;
1318
+ }
1319
+ return b == &PyBaseObject_Type;
1320
+ }
1321
+
1322
+ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
1323
+ PyObject *mro;
1324
+ if (a == b) return 1;
1325
+ mro = a->tp_mro;
1326
+ if (likely(mro)) {
1327
+ Py_ssize_t i, n;
1328
+ n = PyTuple_GET_SIZE(mro);
1329
+ for (i = 0; i < n; i++) {
1330
+ if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
1331
+ return 1;
1332
+ }
1333
+ return 0;
1334
+ }
1335
+ // should only get here for incompletely initialised types, i.e. never under normal usage patterns
1336
+ return __Pyx_InBases(a, b);
1337
+ }
1338
+
1339
+ static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
1340
+ PyObject *mro;
1341
+ if (cls == a || cls == b) return 1;
1342
+ mro = cls->tp_mro;
1343
+ if (likely(mro)) {
1344
+ Py_ssize_t i, n;
1345
+ n = PyTuple_GET_SIZE(mro);
1346
+ for (i = 0; i < n; i++) {
1347
+ PyObject *base = PyTuple_GET_ITEM(mro, i);
1348
+ if (base == (PyObject *)a || base == (PyObject *)b)
1349
+ return 1;
1350
+ }
1351
+ return 0;
1352
+ }
1353
+ // should only get here for incompletely initialised types, i.e. never under normal usage patterns
1354
+ return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
1355
+ }
1356
+
1357
+
1358
+ static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
1359
+ if (exc_type1) {
1360
+ return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
1361
+ } else {
1362
+ return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
1363
+ }
1364
+ }
1365
+
1366
+ // so far, we only call PyErr_GivenExceptionMatches() with an exception type (not instance) as first argument
1367
+ // => optimise for that case
1368
+
1369
+ static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
1370
+ Py_ssize_t i, n;
1371
+ assert(PyExceptionClass_Check(exc_type));
1372
+ n = PyTuple_GET_SIZE(tuple);
1373
+ // the tight subtype checking in Py3 allows faster out-of-order comparison
1374
+ for (i=0; i<n; i++) {
1375
+ if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
1376
+ }
1377
+ for (i=0; i<n; i++) {
1378
+ PyObject *t = PyTuple_GET_ITEM(tuple, i);
1379
+ if (likely(PyExceptionClass_Check(t))) {
1380
+ if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
1381
+ } else {
1382
+ // FIXME: Py3: PyErr_SetString(PyExc_TypeError, "catching classes that do not inherit from BaseException is not allowed");
1383
+ }
1384
+ }
1385
+ return 0;
1386
+ }
1387
+
1388
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
1389
+ if (likely(err == exc_type)) return 1;
1390
+ if (likely(PyExceptionClass_Check(err))) {
1391
+ if (likely(PyExceptionClass_Check(exc_type))) {
1392
+ return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
1393
+ } else if (likely(PyTuple_Check(exc_type))) {
1394
+ return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
1395
+ } else {
1396
+ // FIXME: Py3: PyErr_SetString(PyExc_TypeError, "catching classes that do not inherit from BaseException is not allowed");
1397
+ }
1398
+ }
1399
+ return PyErr_GivenExceptionMatches(err, exc_type);
1400
+ }
1401
+
1402
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
1403
+ // Only used internally with known exception types => pure safety check assertions.
1404
+ assert(PyExceptionClass_Check(exc_type1));
1405
+ assert(PyExceptionClass_Check(exc_type2));
1406
+ if (likely(err == exc_type1 || err == exc_type2)) return 1;
1407
+ if (likely(PyExceptionClass_Check(err))) {
1408
+ return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
1409
+ }
1410
+ return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
1411
+ }
1412
+
1413
+ #endif
1414
+
1415
+
1416
+ /////////////// MathInitCode ///////////////
1417
+
1418
+ #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
1419
+ #ifndef _USE_MATH_DEFINES
1420
+ #define _USE_MATH_DEFINES
1421
+ #endif
1422
+ #endif
1423
+ #include <math.h>
1424
+
1425
+ #ifdef NAN
1426
+ #define __PYX_NAN() ((float) NAN)
1427
+ #else
1428
+ static CYTHON_INLINE float __PYX_NAN() {
1429
+ // Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
1430
+ // a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
1431
+ // a quiet NaN.
1432
+ float value;
1433
+ memset(&value, 0xFF, sizeof(value));
1434
+ return value;
1435
+ }
1436
+ #endif
1437
+
1438
+ #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
1439
+ #define __Pyx_truncl trunc
1440
+ #else
1441
+ #define __Pyx_truncl truncl
1442
+ #endif
1443
+
1444
+ /////////////// ForceInitThreads.proto ///////////////
1445
+ //@proto_block: utility_code_proto_before_types
1446
+
1447
+ #ifndef __PYX_FORCE_INIT_THREADS
1448
+ #define __PYX_FORCE_INIT_THREADS 0
1449
+ #endif
1450
+
1451
+
1452
+ /////////////// ModuleCreationPEP489 ///////////////
1453
+ //@substitute: naming
1454
+
1455
+ //#if CYTHON_PEP489_MULTI_PHASE_INIT
1456
+ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
1457
+ static PY_INT64_T main_interpreter_id = -1;
1458
+ #if CYTHON_COMPILING_IN_GRAAL
1459
+ PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
1460
+ #else
1461
+ PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
1462
+ #endif
1463
+ if (main_interpreter_id == -1) {
1464
+ main_interpreter_id = current_id;
1465
+ return (unlikely(current_id == -1)) ? -1 : 0;
1466
+ } else if (unlikely(main_interpreter_id != current_id))
1467
+
1468
+ {
1469
+ PyErr_SetString(
1470
+ PyExc_ImportError,
1471
+ "Interpreter change detected - this module can only be loaded into one interpreter per process.");
1472
+ return -1;
1473
+ }
1474
+ return 0;
1475
+ }
1476
+
1477
+ #if CYTHON_COMPILING_IN_LIMITED_API
1478
+ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
1479
+ #else
1480
+ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
1481
+ #endif
1482
+ {
1483
+ PyObject *value = PyObject_GetAttrString(spec, from_name);
1484
+ int result = 0;
1485
+ if (likely(value)) {
1486
+ if (allow_none || value != Py_None) {
1487
+ #if CYTHON_COMPILING_IN_LIMITED_API
1488
+ result = PyModule_AddObject(module, to_name, value);
1489
+ #else
1490
+ result = PyDict_SetItemString(moddict, to_name, value);
1491
+ #endif
1492
+ }
1493
+ Py_DECREF(value);
1494
+ } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
1495
+ PyErr_Clear();
1496
+ } else {
1497
+ result = -1;
1498
+ }
1499
+ return result;
1500
+ }
1501
+
1502
+ static CYTHON_SMALL_CODE PyObject* ${pymodule_create_func_cname}(PyObject *spec, PyModuleDef *def) {
1503
+ PyObject *module = NULL, *moddict, *modname;
1504
+ CYTHON_UNUSED_VAR(def);
1505
+
1506
+ // For now, we only have exactly one module instance.
1507
+ if (__Pyx_check_single_interpreter())
1508
+ return NULL;
1509
+ if (${module_cname})
1510
+ return __Pyx_NewRef(${module_cname});
1511
+
1512
+ modname = PyObject_GetAttrString(spec, "name");
1513
+ if (unlikely(!modname)) goto bad;
1514
+
1515
+ module = PyModule_NewObject(modname);
1516
+ Py_DECREF(modname);
1517
+ if (unlikely(!module)) goto bad;
1518
+
1519
+ #if CYTHON_COMPILING_IN_LIMITED_API
1520
+ moddict = module;
1521
+ #else
1522
+ moddict = PyModule_GetDict(module);
1523
+ if (unlikely(!moddict)) goto bad;
1524
+ // moddict is a borrowed reference
1525
+ #endif
1526
+
1527
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
1528
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
1529
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
1530
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
1531
+
1532
+ return module;
1533
+ bad:
1534
+ Py_XDECREF(module);
1535
+ return NULL;
1536
+ }
1537
+ //#endif
1538
+
1539
+
1540
+ /////////////// CodeObjectCache.proto ///////////////
1541
+
1542
+ #if CYTHON_COMPILING_IN_LIMITED_API
1543
+ typedef PyObject __Pyx_CachedCodeObjectType;
1544
+ #else
1545
+ typedef PyCodeObject __Pyx_CachedCodeObjectType;
1546
+ #endif
1547
+
1548
+ typedef struct {
1549
+ __Pyx_CachedCodeObjectType* code_object;
1550
+ int code_line;
1551
+ } __Pyx_CodeObjectCacheEntry;
1552
+
1553
+ struct __Pyx_CodeObjectCache {
1554
+ int count;
1555
+ int max_count;
1556
+ __Pyx_CodeObjectCacheEntry* entries;
1557
+ };
1558
+
1559
+ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1560
+
1561
+ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1562
+
1563
+ static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
1564
+ static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);
1565
+
1566
+ /////////////// CodeObjectCache ///////////////
1567
+ // Note that errors are simply ignored in the code below.
1568
+ // This is just a cache, if a lookup or insertion fails - so what?
1569
+
1570
+ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
1571
+ int start = 0, mid = 0, end = count - 1;
1572
+ if (end >= 0 && code_line > entries[end].code_line) {
1573
+ return count;
1574
+ }
1575
+ while (start < end) {
1576
+ mid = start + (end - start) / 2;
1577
+ if (code_line < entries[mid].code_line) {
1578
+ end = mid;
1579
+ } else if (code_line > entries[mid].code_line) {
1580
+ start = mid + 1;
1581
+ } else {
1582
+ return mid;
1583
+ }
1584
+ }
1585
+ if (code_line <= entries[mid].code_line) {
1586
+ return mid;
1587
+ } else {
1588
+ return mid + 1;
1589
+ }
1590
+ }
1591
+
1592
+ static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
1593
+ __Pyx_CachedCodeObjectType* code_object;
1594
+ int pos;
1595
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
1596
+ return NULL;
1597
+ }
1598
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
1599
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
1600
+ return NULL;
1601
+ }
1602
+ code_object = __pyx_code_cache.entries[pos].code_object;
1603
+ Py_INCREF(code_object);
1604
+ return code_object;
1605
+ }
1606
+
1607
+ static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object)
1608
+ {
1609
+ int pos, i;
1610
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
1611
+ if (unlikely(!code_line)) {
1612
+ return;
1613
+ }
1614
+ if (unlikely(!entries)) {
1615
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
1616
+ if (likely(entries)) {
1617
+ __pyx_code_cache.entries = entries;
1618
+ __pyx_code_cache.max_count = 64;
1619
+ __pyx_code_cache.count = 1;
1620
+ entries[0].code_line = code_line;
1621
+ entries[0].code_object = code_object;
1622
+ Py_INCREF(code_object);
1623
+ }
1624
+ return;
1625
+ }
1626
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
1627
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
1628
+ __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
1629
+ entries[pos].code_object = code_object;
1630
+ Py_DECREF(tmp);
1631
+ return;
1632
+ }
1633
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
1634
+ int new_max = __pyx_code_cache.max_count + 64;
1635
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
1636
+ __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
1637
+ if (unlikely(!entries)) {
1638
+ return;
1639
+ }
1640
+ __pyx_code_cache.entries = entries;
1641
+ __pyx_code_cache.max_count = new_max;
1642
+ }
1643
+ for (i=__pyx_code_cache.count; i>pos; i--) {
1644
+ entries[i] = entries[i-1];
1645
+ }
1646
+ entries[pos].code_line = code_line;
1647
+ entries[pos].code_object = code_object;
1648
+ __pyx_code_cache.count++;
1649
+ Py_INCREF(code_object);
1650
+ }
1651
+
1652
+ /////////////// CodeObjectCache.cleanup ///////////////
1653
+
1654
+ if (__pyx_code_cache.entries) {
1655
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
1656
+ int i, count = __pyx_code_cache.count;
1657
+ __pyx_code_cache.count = 0;
1658
+ __pyx_code_cache.max_count = 0;
1659
+ __pyx_code_cache.entries = NULL;
1660
+ for (i=0; i<count; i++) {
1661
+ Py_DECREF(entries[i].code_object);
1662
+ }
1663
+ PyMem_Free(entries);
1664
+ }
1665
+
1666
+ /////////////// GetRuntimeVersion.proto ///////////////
1667
+
1668
+ static unsigned long __Pyx_get_runtime_version(void);
1669
+
1670
+ /////////////// GetRuntimeVersion ///////////////
1671
+
1672
+ static unsigned long __Pyx_get_runtime_version(void) {
1673
+ // We will probably never need the alpha/beta status, so avoid the complexity to parse it.
1674
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
1675
+ return Py_Version & ~0xFFUL;
1676
+ #else
1677
+ static unsigned long __Pyx_cached_runtime_version = 0;
1678
+ if (__Pyx_cached_runtime_version == 0) {
1679
+ const char* rt_version = Py_GetVersion();
1680
+ unsigned long version = 0;
1681
+ unsigned long factor = 0x01000000UL;
1682
+ unsigned int digit = 0;
1683
+ int i = 0;
1684
+ while (factor) {
1685
+ while ('0' <= rt_version[i] && rt_version[i] <= '9') {
1686
+ digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
1687
+ ++i;
1688
+ }
1689
+ version += factor * digit;
1690
+ if (rt_version[i] != '.')
1691
+ break;
1692
+ digit = 0;
1693
+ factor >>= 8;
1694
+ ++i;
1695
+ }
1696
+ __Pyx_cached_runtime_version = version;
1697
+ }
1698
+ return __Pyx_cached_runtime_version;
1699
+ #endif
1700
+ }
1701
+
1702
+ /////////////// CheckBinaryVersion.proto ///////////////
1703
+
1704
+ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
1705
+
1706
+ /////////////// CheckBinaryVersion ///////////////
1707
+
1708
+ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
1709
+ // runtime version is: -1 => older, 0 => equal, 1 => newer
1710
+ const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
1711
+ if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
1712
+ return 0;
1713
+ if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
1714
+ return 1;
1715
+
1716
+ {
1717
+ char message[200];
1718
+ PyOS_snprintf(message, sizeof(message),
1719
+ "compile time Python version %d.%d "
1720
+ "of module '%.100s' "
1721
+ "%s "
1722
+ "runtime version %d.%d",
1723
+ (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
1724
+ __Pyx_MODULE_NAME,
1725
+ (allow_newer) ? "was newer than" : "does not match",
1726
+ (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
1727
+ );
1728
+ // returns 0 or -1
1729
+ return PyErr_WarnEx(NULL, message, 1);
1730
+ }
1731
+ }
1732
+
1733
+ /////////////// IsLittleEndian.proto ///////////////
1734
+
1735
+ static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1736
+
1737
+ /////////////// IsLittleEndian ///////////////
1738
+
1739
+ static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
1740
+ {
1741
+ union {
1742
+ uint32_t u32;
1743
+ uint8_t u8[4];
1744
+ } S;
1745
+ S.u32 = 0x01020304;
1746
+ return S.u8[0] == 4;
1747
+ }
1748
+
1749
+ /////////////// Refnanny.proto ///////////////
1750
+
1751
+ #ifndef CYTHON_REFNANNY
1752
+ #define CYTHON_REFNANNY 0
1753
+ #endif
1754
+
1755
+ #if CYTHON_REFNANNY
1756
+ typedef struct {
1757
+ void (*INCREF)(void*, PyObject*, Py_ssize_t);
1758
+ void (*DECREF)(void*, PyObject*, Py_ssize_t);
1759
+ void (*GOTREF)(void*, PyObject*, Py_ssize_t);
1760
+ void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
1761
+ void* (*SetupContext)(const char*, Py_ssize_t, const char*);
1762
+ void (*FinishContext)(void**);
1763
+ } __Pyx_RefNannyAPIStruct;
1764
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1765
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
1766
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1767
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
1768
+ if (acquire_gil) { \
1769
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
1770
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)); \
1771
+ PyGILState_Release(__pyx_gilstate_save); \
1772
+ } else { \
1773
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)); \
1774
+ }
1775
+ #define __Pyx_RefNannyFinishContextNogil() { \
1776
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
1777
+ __Pyx_RefNannyFinishContext(); \
1778
+ PyGILState_Release(__pyx_gilstate_save); \
1779
+ }
1780
+ #define __Pyx_RefNannyFinishContextNogil() { \
1781
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
1782
+ __Pyx_RefNannyFinishContext(); \
1783
+ PyGILState_Release(__pyx_gilstate_save); \
1784
+ }
1785
+ #define __Pyx_RefNannyFinishContext() \
1786
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1787
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1788
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1789
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1790
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1791
+ #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1792
+ #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1793
+ #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1794
+ #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1795
+ #else
1796
+ #define __Pyx_RefNannyDeclarations
1797
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
1798
+ #define __Pyx_RefNannyFinishContextNogil()
1799
+ #define __Pyx_RefNannyFinishContext()
1800
+ #define __Pyx_INCREF(r) Py_INCREF(r)
1801
+ #define __Pyx_DECREF(r) Py_DECREF(r)
1802
+ #define __Pyx_GOTREF(r)
1803
+ #define __Pyx_GIVEREF(r)
1804
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
1805
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
1806
+ #define __Pyx_XGOTREF(r)
1807
+ #define __Pyx_XGIVEREF(r)
1808
+ #endif /* CYTHON_REFNANNY */
1809
+
1810
+ #define __Pyx_Py_XDECREF_SET(r, v) do { \
1811
+ PyObject *tmp = (PyObject *) r; \
1812
+ r = v; Py_XDECREF(tmp); \
1813
+ } while (0)
1814
+ #define __Pyx_XDECREF_SET(r, v) do { \
1815
+ PyObject *tmp = (PyObject *) r; \
1816
+ r = v; __Pyx_XDECREF(tmp); \
1817
+ } while (0)
1818
+ #define __Pyx_DECREF_SET(r, v) do { \
1819
+ PyObject *tmp = (PyObject *) r; \
1820
+ r = v; __Pyx_DECREF(tmp); \
1821
+ } while (0)
1822
+
1823
+ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1824
+ #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1825
+
1826
+ /////////////// Refnanny ///////////////
1827
+
1828
+ #if CYTHON_REFNANNY
1829
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
1830
+ PyObject *m = NULL, *p = NULL;
1831
+ void *r = NULL;
1832
+ m = PyImport_ImportModule(modname);
1833
+ if (!m) goto end;
1834
+ p = PyObject_GetAttrString(m, "RefNannyAPI");
1835
+ if (!p) goto end;
1836
+ r = PyLong_AsVoidPtr(p);
1837
+ end:
1838
+ Py_XDECREF(p);
1839
+ Py_XDECREF(m);
1840
+ return (__Pyx_RefNannyAPIStruct *)r;
1841
+ }
1842
+ #endif /* CYTHON_REFNANNY */
1843
+
1844
+
1845
+ /////////////// ImportRefnannyAPI ///////////////
1846
+
1847
+ #if CYTHON_REFNANNY
1848
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
1849
+ if (!__Pyx_RefNanny) {
1850
+ PyErr_Clear();
1851
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
1852
+ if (!__Pyx_RefNanny)
1853
+ Py_FatalError("failed to import 'refnanny' module");
1854
+ }
1855
+ #endif
1856
+
1857
+
1858
+ /////////////// RegisterModuleCleanup.proto ///////////////
1859
+ //@substitute: naming
1860
+
1861
+ static void ${cleanup_cname}(PyObject *self); /*proto*/
1862
+
1863
+ #if CYTHON_COMPILING_IN_PYPY
1864
+ static int __Pyx_RegisterCleanup(void); /*proto*/
1865
+ #else
1866
+ #define __Pyx_RegisterCleanup() (0)
1867
+ #endif
1868
+
1869
+ /////////////// RegisterModuleCleanup ///////////////
1870
+ //@substitute: naming
1871
+
1872
+ #if CYTHON_COMPILING_IN_PYPY
1873
+ static PyObject* ${cleanup_cname}_atexit(PyObject *module, PyObject *unused) {
1874
+ CYTHON_UNUSED_VAR(unused);
1875
+ ${cleanup_cname}(module);
1876
+ Py_INCREF(Py_None); return Py_None;
1877
+ }
1878
+
1879
+ static int __Pyx_RegisterCleanup(void) {
1880
+ // Don't use Py_AtExit because that has a 32-call limit and is called
1881
+ // after python finalization.
1882
+ // Also, we try to prepend the cleanup function to "atexit._exithandlers"
1883
+ // in Py2 because CPython runs them last-to-first. Being run last allows
1884
+ // user exit code to run before us that may depend on the globals
1885
+ // and cached objects that we are about to clean up.
1886
+
1887
+ static PyMethodDef cleanup_def = {
1888
+ "__cleanup", (PyCFunction)${cleanup_cname}_atexit, METH_NOARGS, 0};
1889
+
1890
+ PyObject *cleanup_func = 0;
1891
+ PyObject *atexit = 0;
1892
+ PyObject *reg = 0;
1893
+ PyObject *args = 0;
1894
+ PyObject *res = 0;
1895
+ int ret = -1;
1896
+
1897
+ cleanup_func = PyCFunction_New(&cleanup_def, 0);
1898
+ if (!cleanup_func)
1899
+ goto bad;
1900
+
1901
+ atexit = PyImport_ImportModule("atexit");
1902
+ if (!atexit)
1903
+ goto bad;
1904
+ reg = PyObject_GetAttrString(atexit, "_exithandlers");
1905
+ if (reg && PyList_Check(reg)) {
1906
+ PyObject *a, *kw;
1907
+ a = PyTuple_New(0);
1908
+ kw = PyDict_New();
1909
+ if (!a || !kw) {
1910
+ Py_XDECREF(a);
1911
+ Py_XDECREF(kw);
1912
+ goto bad;
1913
+ }
1914
+ args = PyTuple_Pack(3, cleanup_func, a, kw);
1915
+ Py_DECREF(a);
1916
+ Py_DECREF(kw);
1917
+ if (!args)
1918
+ goto bad;
1919
+ ret = PyList_Insert(reg, 0, args);
1920
+ } else {
1921
+ if (!reg)
1922
+ PyErr_Clear();
1923
+ Py_XDECREF(reg);
1924
+ reg = PyObject_GetAttrString(atexit, "register");
1925
+ if (!reg)
1926
+ goto bad;
1927
+ args = PyTuple_Pack(1, cleanup_func);
1928
+ if (!args)
1929
+ goto bad;
1930
+ res = PyObject_CallObject(reg, args);
1931
+ if (!res)
1932
+ goto bad;
1933
+ ret = 0;
1934
+ }
1935
+ bad:
1936
+ Py_XDECREF(cleanup_func);
1937
+ Py_XDECREF(atexit);
1938
+ Py_XDECREF(reg);
1939
+ Py_XDECREF(args);
1940
+ Py_XDECREF(res);
1941
+ return ret;
1942
+ }
1943
+ #endif
1944
+
1945
+ /////////////// FastGil.init ///////////////
1946
+ __Pyx_FastGilFuncInit();
1947
+
1948
+ /////////////// NoFastGil.proto ///////////////
1949
+ //@proto_block: utility_code_proto_before_types
1950
+
1951
+ #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1952
+ #define __Pyx_PyGILState_Release PyGILState_Release
1953
+ #define __Pyx_FastGIL_Remember()
1954
+ #define __Pyx_FastGIL_Forget()
1955
+ #define __Pyx_FastGilFuncInit()
1956
+
1957
+ /////////////// FastGil.proto ///////////////
1958
+ //@proto_block: utility_code_proto_before_types
1959
+
1960
+ #if CYTHON_FAST_GIL
1961
+
1962
+ struct __Pyx_FastGilVtab {
1963
+ PyGILState_STATE (*Fast_PyGILState_Ensure)(void);
1964
+ void (*Fast_PyGILState_Release)(PyGILState_STATE oldstate);
1965
+ void (*FastGIL_Remember)(void);
1966
+ void (*FastGIL_Forget)(void);
1967
+ };
1968
+
1969
+ static void __Pyx_FastGIL_Noop(void) {}
1970
+ static struct __Pyx_FastGilVtab __Pyx_FastGilFuncs = {
1971
+ PyGILState_Ensure,
1972
+ PyGILState_Release,
1973
+ __Pyx_FastGIL_Noop,
1974
+ __Pyx_FastGIL_Noop
1975
+ };
1976
+
1977
+ static void __Pyx_FastGilFuncInit(void);
1978
+
1979
+ #define __Pyx_PyGILState_Ensure __Pyx_FastGilFuncs.Fast_PyGILState_Ensure
1980
+ #define __Pyx_PyGILState_Release __Pyx_FastGilFuncs.Fast_PyGILState_Release
1981
+ #define __Pyx_FastGIL_Remember __Pyx_FastGilFuncs.FastGIL_Remember
1982
+ #define __Pyx_FastGIL_Forget __Pyx_FastGilFuncs.FastGIL_Forget
1983
+
1984
+ #ifndef CYTHON_THREAD_LOCAL
1985
+ #if defined(__cplusplus) && __cplusplus >= 201103L
1986
+ #define CYTHON_THREAD_LOCAL thread_local
1987
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112
1988
+ #define CYTHON_THREAD_LOCAL _Thread_local
1989
+ #elif defined(__GNUC__)
1990
+ #define CYTHON_THREAD_LOCAL __thread
1991
+ #elif defined(_MSC_VER)
1992
+ #define CYTHON_THREAD_LOCAL __declspec(thread)
1993
+ #endif
1994
+ #endif
1995
+
1996
+ #else
1997
+ #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1998
+ #define __Pyx_PyGILState_Release PyGILState_Release
1999
+ #define __Pyx_FastGIL_Remember()
2000
+ #define __Pyx_FastGIL_Forget()
2001
+ #define __Pyx_FastGilFuncInit()
2002
+ #endif
2003
+
2004
+ /////////////// FastGil ///////////////
2005
+ // The implementations of PyGILState_Ensure/Release calls PyThread_get_key_value
2006
+ // several times which is turns out to be quite slow (slower in fact than
2007
+ // acquiring the GIL itself). Simply storing it in a thread local for the
2008
+ // common case is much faster.
2009
+ // To make optimal use of this thread local, we attempt to share it between
2010
+ // modules.
2011
+
2012
+ #if CYTHON_FAST_GIL
2013
+
2014
+ #define __Pyx_FastGIL_ABI_module __PYX_ABI_MODULE_NAME
2015
+ #define __Pyx_FastGIL_PyCapsuleName "FastGilFuncs"
2016
+ #define __Pyx_FastGIL_PyCapsule \
2017
+ __Pyx_FastGIL_ABI_module "." __Pyx_FastGIL_PyCapsuleName
2018
+
2019
+ #ifdef CYTHON_THREAD_LOCAL
2020
+
2021
+ #include "pythread.h"
2022
+ #include "pystate.h"
2023
+
2024
+ static CYTHON_THREAD_LOCAL PyThreadState *__Pyx_FastGil_tcur = NULL;
2025
+ static CYTHON_THREAD_LOCAL int __Pyx_FastGil_tcur_depth = 0;
2026
+ static int __Pyx_FastGil_autoTLSkey = -1;
2027
+
2028
+ static CYTHON_INLINE void __Pyx_FastGIL_Remember0(void) {
2029
+ ++__Pyx_FastGil_tcur_depth;
2030
+ }
2031
+
2032
+ static CYTHON_INLINE void __Pyx_FastGIL_Forget0(void) {
2033
+ if (--__Pyx_FastGil_tcur_depth == 0) {
2034
+ __Pyx_FastGil_tcur = NULL;
2035
+ }
2036
+ }
2037
+
2038
+ static CYTHON_INLINE PyThreadState *__Pyx_FastGil_get_tcur(void) {
2039
+ PyThreadState *tcur = __Pyx_FastGil_tcur;
2040
+ if (tcur == NULL) {
2041
+ tcur = __Pyx_FastGil_tcur = (PyThreadState*)PyThread_get_key_value(__Pyx_FastGil_autoTLSkey);
2042
+ }
2043
+ return tcur;
2044
+ }
2045
+
2046
+ static PyGILState_STATE __Pyx_FastGil_PyGILState_Ensure(void) {
2047
+ int current;
2048
+ PyThreadState *tcur;
2049
+ __Pyx_FastGIL_Remember0();
2050
+ tcur = __Pyx_FastGil_get_tcur();
2051
+ if (tcur == NULL) {
2052
+ // Uninitialized, need to initialize now.
2053
+ return PyGILState_Ensure();
2054
+ }
2055
+ current = tcur == __Pyx_PyThreadState_Current;
2056
+ if (current == 0) {
2057
+ PyEval_RestoreThread(tcur);
2058
+ }
2059
+ ++tcur->gilstate_counter;
2060
+ return current ? PyGILState_LOCKED : PyGILState_UNLOCKED;
2061
+ }
2062
+
2063
+ static void __Pyx_FastGil_PyGILState_Release(PyGILState_STATE oldstate) {
2064
+ PyThreadState *tcur = __Pyx_FastGil_get_tcur();
2065
+ __Pyx_FastGIL_Forget0();
2066
+ if (tcur->gilstate_counter == 1) {
2067
+ // This is the last lock, do all the cleanup as well.
2068
+ PyGILState_Release(oldstate);
2069
+ } else {
2070
+ --tcur->gilstate_counter;
2071
+ if (oldstate == PyGILState_UNLOCKED) {
2072
+ PyEval_SaveThread();
2073
+ }
2074
+ }
2075
+ }
2076
+
2077
+ static void __Pyx_FastGilFuncInit0(void) {
2078
+ /* Try to detect autoTLSkey. */
2079
+ int key;
2080
+ void* this_thread_state = (void*) PyGILState_GetThisThreadState();
2081
+ for (key = 0; key < 100; key++) {
2082
+ if (PyThread_get_key_value(key) == this_thread_state) {
2083
+ __Pyx_FastGil_autoTLSkey = key;
2084
+ break;
2085
+ }
2086
+ }
2087
+ if (__Pyx_FastGil_autoTLSkey != -1) {
2088
+ PyObject* capsule = NULL;
2089
+ PyObject* abi_module = NULL;
2090
+ __Pyx_PyGILState_Ensure = __Pyx_FastGil_PyGILState_Ensure;
2091
+ __Pyx_PyGILState_Release = __Pyx_FastGil_PyGILState_Release;
2092
+ __Pyx_FastGIL_Remember = __Pyx_FastGIL_Remember0;
2093
+ __Pyx_FastGIL_Forget = __Pyx_FastGIL_Forget0;
2094
+ capsule = PyCapsule_New(&__Pyx_FastGilFuncs, __Pyx_FastGIL_PyCapsule, NULL);
2095
+ if (capsule) {
2096
+ abi_module = __Pyx_PyImport_AddModuleRef(__Pyx_FastGIL_ABI_module);
2097
+ if (abi_module) {
2098
+ PyObject_SetAttrString(abi_module, __Pyx_FastGIL_PyCapsuleName, capsule);
2099
+ Py_DECREF(abi_module);
2100
+ }
2101
+ }
2102
+ Py_XDECREF(capsule);
2103
+ }
2104
+ }
2105
+
2106
+ #else
2107
+
2108
+ static void __Pyx_FastGilFuncInit0(void) {
2109
+ }
2110
+
2111
+ #endif
2112
+
2113
+ static void __Pyx_FastGilFuncInit(void) {
2114
+ struct __Pyx_FastGilVtab* shared = (struct __Pyx_FastGilVtab*)PyCapsule_Import(__Pyx_FastGIL_PyCapsule, 1);
2115
+ if (shared) {
2116
+ __Pyx_FastGilFuncs = *shared;
2117
+ } else {
2118
+ PyErr_Clear();
2119
+ __Pyx_FastGilFuncInit0();
2120
+ }
2121
+ }
2122
+
2123
+ #endif
2124
+
2125
+ ///////////////////// PretendToInitialize ////////////////////////
2126
+
2127
+ #ifdef __cplusplus
2128
+ // In C++ a variable must actually be initialized to make returning
2129
+ // it defined behaviour, and there doesn't seem to be a viable compiler trick to
2130
+ // avoid that.
2131
+ #include <type_traits>
2132
+ template <typename T>
2133
+ static void __Pyx_pretend_to_initialize(T* ptr) {
2134
+ // In C++11 we have enough introspection to work out which types it's actually
2135
+ // necessary to apply this to (non-trivial types will have been initialized by
2136
+ // the definition). Below C++11 just initialize everything.
2137
+ #if __cplusplus > 201103L
2138
+ if ((std::is_trivially_default_constructible<T>::value))
2139
+ #endif
2140
+ *ptr = T();
2141
+ (void)ptr;
2142
+ }
2143
+ #else
2144
+ // For C, taking an address of a variable is enough to make returning it
2145
+ // defined behaviour.
2146
+ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
2147
+ #endif
2148
+
2149
+ ///////////////////// UtilityCodePragmas /////////////////////////
2150
+
2151
+ #ifdef _MSC_VER
2152
+ #pragma warning( push )
2153
+ /* Warning 4127: conditional expression is constant
2154
+ * Cython uses constant conditional expressions to allow in inline functions to be optimized at
2155
+ * compile-time, so this warning is not useful
2156
+ */
2157
+ #pragma warning( disable : 4127 )
2158
+ #endif
2159
+
2160
+ ///////////////////// UtilityCodePragmasEnd //////////////////////
2161
+
2162
+ #ifdef _MSC_VER
2163
+ #pragma warning( pop ) /* undo whatever Cython has done to warnings */
2164
+ #endif
2165
+
2166
+
2167
+ //////////////////// NewCodeObj.proto ////////////////////////
2168
+ //@proto_block: init_codeobjects
2169
+
2170
+ static PyObject* __Pyx_PyCode_New(
2171
+ //int argcount,
2172
+ //int num_posonly_args,
2173
+ //int num_kwonly_args,
2174
+ //int nlocals,
2175
+ // int s,
2176
+ //int flags,
2177
+ //int first_line,
2178
+ __Pyx_PyCode_New_function_description descr,
2179
+ // PyObject *code,
2180
+ // PyObject *consts,
2181
+ // PyObject* n,
2182
+ // PyObject *varnames_tuple,
2183
+ PyObject **varnames,
2184
+ // PyObject *freevars,
2185
+ // PyObject *cellvars,
2186
+ PyObject *filename,
2187
+ PyObject *funcname,
2188
+ const char *line_table,
2189
+ PyObject *tuple_dedup_map
2190
+ );/*proto*/
2191
+
2192
+ //////////////////// NewCodeObj ////////////////////////
2193
+
2194
+ #if CYTHON_COMPILING_IN_LIMITED_API
2195
+ // Note that the limited API doesn't know about PyCodeObject, so the type of this
2196
+ // is PyObject (unlike for the main API)
2197
+ static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
2198
+ PyObject *code, PyObject *c, PyObject* n, PyObject *v,
2199
+ PyObject *fv, PyObject *cell, PyObject* fn,
2200
+ PyObject *name, int fline, PyObject *lnos) {
2201
+ // Backout option for generating a code object.
2202
+ // PyCode_NewEmpty isn't in the limited API. Therefore the two options are
2203
+ // 1. Python call of the code type with a long list of positional args.
2204
+ // 2. Generate a code object by compiling some trivial code, and customize.
2205
+ // We use the second because it's less sensitive to changes in the code type
2206
+ // constructor with version.
2207
+ PyObject *exception_table = NULL;
2208
+ PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
2209
+ #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
2210
+ PyObject *version_info; /* borrowed */
2211
+ PyObject *py_minor_version = NULL;
2212
+ #endif
2213
+ long minor_version = 0;
2214
+ PyObject *type, *value, *traceback;
2215
+
2216
+ // we must be able to call this while an exception is happening - thus clear then restore the state
2217
+ PyErr_Fetch(&type, &value, &traceback);
2218
+
2219
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
2220
+ minor_version = 11;
2221
+ // we don't yet need to distinguish between versions > 11
2222
+ // Note that from 3.13, when we do, we can use Py_Version
2223
+ #else
2224
+ if (!(version_info = PySys_GetObject("version_info"))) goto end;
2225
+ if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
2226
+ minor_version = PyLong_AsLong(py_minor_version);
2227
+ Py_DECREF(py_minor_version);
2228
+ if (minor_version == -1 && PyErr_Occurred()) goto end;
2229
+ #endif
2230
+
2231
+ if (!(types_module = PyImport_ImportModule("types"))) goto end;
2232
+ if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
2233
+
2234
+ if (minor_version <= 7) {
2235
+ // 3.7:
2236
+ // code(argcount, kwonlyargcount, nlocals, stacksize, flags, codestring,
2237
+ // constants, names, varnames, filename, name, firstlineno,
2238
+ // lnotab[, freevars[, cellvars]])
2239
+ (void)p;
2240
+ result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
2241
+ c, n, v, fn, name, fline, lnos, fv, cell);
2242
+ } else if (minor_version <= 10) {
2243
+ // 3.8, 3.9, 3.10
2244
+ // code(argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize,
2245
+ // flags, codestring, constants, names, varnames, filename, name,
2246
+ // firstlineno, lnotab[, freevars[, cellvars]])
2247
+ // 3.10 switches lnotab for linetable, but is otherwise the same
2248
+ result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
2249
+ c, n, v, fn, name, fline, lnos, fv, cell);
2250
+ } else {
2251
+ // 3.11, 3.12
2252
+ // code(argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize,
2253
+ // flags, codestring, constants, names, varnames, filename, name,
2254
+ // qualname, firstlineno, linetable, exceptiontable, freevars=(), cellvars=(), /)
2255
+ // We use name and qualname for simplicity
2256
+ if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
2257
+ result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
2258
+ c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
2259
+ }
2260
+
2261
+ end:
2262
+ Py_XDECREF(code_type);
2263
+ Py_XDECREF(exception_table);
2264
+ Py_XDECREF(types_module);
2265
+ if (type) {
2266
+ PyErr_Restore(type, value, traceback);
2267
+ }
2268
+ return result;
2269
+ }
2270
+
2271
+ #elif PY_VERSION_HEX >= 0x030B0000
2272
+ static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
2273
+ PyObject *code, PyObject *c, PyObject* n, PyObject *v,
2274
+ PyObject *fv, PyObject *cell, PyObject* fn,
2275
+ PyObject *name, int fline, PyObject *lnos) {
2276
+ // As earlier versions, but
2277
+ // 1. pass an empty bytes string as exception_table
2278
+ // 2. pass name as qualname (TODO this might implementing properly in future)
2279
+ PyCodeObject *result;
2280
+ result =
2281
+ #if PY_VERSION_HEX >= 0x030C0000
2282
+ PyUnstable_Code_NewWithPosOnlyArgs
2283
+ #else
2284
+ PyCode_NewWithPosOnlyArgs
2285
+ #endif
2286
+ (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, EMPTY(bytes));
2287
+ return result;
2288
+ }
2289
+ #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
2290
+ #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
2291
+ PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
2292
+ #else
2293
+ #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
2294
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
2295
+ #endif
2296
+
2297
+ // This is a specialised helper function for creating Cython's function code objects.
2298
+ // It only receives the arguments that differ between the Cython functions of the module.
2299
+ // This minimises the calling code in the module init function.
2300
+ static PyObject* __Pyx_PyCode_New(
2301
+ //int argcount,
2302
+ //int num_posonly_args,
2303
+ //int num_kwonly_args,
2304
+ //int nlocals,
2305
+ // int s,
2306
+ //int flags,
2307
+ //int first_line,
2308
+ __Pyx_PyCode_New_function_description descr,
2309
+ // PyObject *code,
2310
+ // PyObject *consts,
2311
+ // PyObject* n,
2312
+ // PyObject *varnames_tuple,
2313
+ PyObject **varnames,
2314
+ // PyObject *freevars,
2315
+ // PyObject *cellvars,
2316
+ PyObject* filename,
2317
+ PyObject *funcname,
2318
+ // line table replaced lnotab in Py3.11 (PEP-626)
2319
+ const char *line_table,
2320
+ PyObject *tuple_dedup_map
2321
+ ) {
2322
+
2323
+ PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL, *line_table_bytes = NULL;
2324
+ Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
2325
+
2326
+ PyObject *varnames_tuple = PyTuple_New(var_count);
2327
+ if (unlikely(!varnames_tuple)) return NULL;
2328
+ for (Py_ssize_t i=0; i < var_count; i++) {
2329
+ Py_INCREF(varnames[i]);
2330
+ if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
2331
+ }
2332
+
2333
+ #if CYTHON_COMPILING_IN_LIMITED_API
2334
+ varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
2335
+ if (!varnames_tuple_dedup) {
2336
+ if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
2337
+ varnames_tuple_dedup = varnames_tuple;
2338
+ }
2339
+ #else
2340
+ varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
2341
+ if (unlikely(!varnames_tuple_dedup)) goto done;
2342
+ #endif
2343
+
2344
+ #if CYTHON_AVOID_BORROWED_REFS
2345
+ Py_INCREF(varnames_tuple_dedup);
2346
+ #endif
2347
+
2348
+ if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL) {
2349
+ line_table_bytes = PyBytes_FromStringAndSize(line_table, descr.line_table_length);
2350
+ if (unlikely(!line_table_bytes)) goto done;
2351
+
2352
+ // Allocate a "byte code" array (oversized) to match the addresses in the line table.
2353
+ // Length and alignment must be a multiple of sizeof(_Py_CODEUNIT), which is CPython specific but currently 2.
2354
+ // CPython makes a copy of the code array internally, so make sure it's somewhat short (but not too short).
2355
+ Py_ssize_t code_len = (descr.line_table_length * 2 + 4) & ~3;
2356
+ code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
2357
+ if (unlikely(!code_bytes)) goto done;
2358
+ char* c_code_bytes = PyBytes_AsString(code_bytes);
2359
+ if (unlikely(!c_code_bytes)) goto done;
2360
+ // We initialise the code array to '\0' even though a NOP would be more accurate,
2361
+ // but NOP changes its byte code ID across Python versions/implementations.
2362
+ memset(c_code_bytes, 0, (size_t) code_len);
2363
+ }
2364
+
2365
+ code_obj = (PyObject*) __Pyx__PyCode_New(
2366
+ (int) descr.argcount,
2367
+ (int) descr.num_posonly_args,
2368
+ (int) descr.num_kwonly_args,
2369
+ (int) descr.nlocals,
2370
+ 0,
2371
+ (int) descr.flags,
2372
+ code_bytes ? code_bytes : EMPTY(bytes),
2373
+ EMPTY(tuple),
2374
+ EMPTY(tuple),
2375
+ varnames_tuple_dedup,
2376
+ EMPTY(tuple),
2377
+ EMPTY(tuple),
2378
+ filename,
2379
+ funcname,
2380
+ (int) descr.first_line,
2381
+ (__PYX_LIMITED_VERSION_HEX >= (0x030b0000)) ? line_table_bytes : EMPTY(bytes)
2382
+ );
2383
+
2384
+ done:
2385
+ Py_XDECREF(code_bytes);
2386
+ Py_XDECREF(line_table_bytes);
2387
+ #if CYTHON_AVOID_BORROWED_REFS
2388
+ Py_XDECREF(varnames_tuple_dedup);
2389
+ #endif
2390
+ Py_DECREF(varnames_tuple);
2391
+ return code_obj;
2392
+ }
2393
+
2394
+ /////////////////////////// PyVersionSanityCheck.proto ///////////////////////
2395
+
2396
+ static int __Pyx_VersionSanityCheck(void); /* proto */
2397
+
2398
+ /////////////////////////// PyVersionSanityCheck ///////////////////////
2399
+
2400
+ static int __Pyx_VersionSanityCheck(void) {
2401
+ // Implementation notes:
2402
+ // The main thing I'm worried about in mixing up Py_GIL_DISABLED since this is incredibly
2403
+ // easy to do on Windows (where only a single pyconfig.h is provided, which is shared between
2404
+ // the freethreading and non-freethreading executables). Getting this wrong instantly crashes.
2405
+ //
2406
+ // The debug and trace-refs checks are just because they're easy to do at the same time.
2407
+ //
2408
+ // In order to test it we cannot use any internals of Python objects from C
2409
+ // (especially refcounting) since we potentially have completely the wrong structure
2410
+ // of PyObject. PyRun_SimpleStringFlags and PySys_GetObject both look fairly safe to
2411
+ // use like this.
2412
+ //
2413
+ // Since PyRun_SimpleStringFlags runs in the __main__ scope, we should be careful not
2414
+ // to define variables inside it.
2415
+ // We use PyRun_SimpleStringFlags instead of PyRun_SimpleString since SimpleString is
2416
+ // a macro, and MSVC doesn't like #ifdef within a macro expansion.
2417
+ //
2418
+ // PyRun_SimpleStringFlags prints and clears the exception information. We raise
2419
+ // therefore raise the proper exception from C (I think the interface to PyErr_SetString
2420
+ // should be consistent enough between builds for this to be OK). This is fragile but
2421
+ // the best we can do.
2422
+ //
2423
+ #if CYTHON_COMPILING_IN_CPYTHON
2424
+ // from Python 3.8 debug and release builds are ABI compatible so skip the check
2425
+ #if PY_VERSION_HEX < 0x03080000
2426
+ if (PySys_GetObject("gettotalrefcount")) {
2427
+ #ifndef Py_DEBUG
2428
+ PyErr_SetString(
2429
+ PyExc_ImportError,
2430
+ "Module was compiled with a non-debug version of Python but imported into a debug version."
2431
+ );
2432
+ return -1;
2433
+ #endif
2434
+ } else {
2435
+ #ifdef Py_DEBUG
2436
+ PyErr_SetString(
2437
+ PyExc_ImportError,
2438
+ "Module was compiled with a debug version of Python but imported into a non-debug version."
2439
+ );
2440
+ return -1;
2441
+ #endif
2442
+ }
2443
+ #endif // Py_VERSION_HEX < 0x03080000
2444
+ #if PY_VERSION_HEX >= 0x030d0000
2445
+ if (PyRun_SimpleStringFlags(
2446
+ "if "
2447
+ #ifdef Py_GIL_DISABLED
2448
+ "not "
2449
+ #endif
2450
+ "__import__('sysconfig').get_config_var('Py_GIL_DISABLED'): raise ImportError",
2451
+ NULL
2452
+ ) == -1) {
2453
+ PyErr_SetString(
2454
+ PyExc_ImportError,
2455
+ #ifdef Py_GIL_DISABLED
2456
+ "Module was compiled with a freethreading build of Python but imported into a non-freethreading build."
2457
+ #else
2458
+ "Module was compiled with a non-freethreading build of Python but imported into a freethreading build."
2459
+ #endif
2460
+ );
2461
+ return -1;
2462
+ }
2463
+ #endif // version hex 3.13+
2464
+ if (PySys_GetObject("getobjects")) {
2465
+ #ifndef Py_TRACE_REFS
2466
+ PyErr_SetString(
2467
+ PyExc_ImportError,
2468
+ "Module was compiled without Py_TRACE_REFS but imported into a build of Python with."
2469
+ );
2470
+ return -1;
2471
+ #endif
2472
+ } else {
2473
+ #ifdef Py_TRACE_REFS
2474
+ PyErr_SetString(
2475
+ PyExc_ImportError,
2476
+ "Module was compiled with Py_TRACE_REFS but imported into a build of Python without."
2477
+ );
2478
+ return -1;
2479
+ #endif
2480
+ }
2481
+ const char code[] = "if __import__('sys').getsizeof(object()) != %u: raise ImportError";
2482
+ char formattedCode[sizeof(code)+50];
2483
+ PyOS_snprintf(formattedCode, sizeof(formattedCode), code, (unsigned int)sizeof(PyObject));
2484
+ if (PyRun_SimpleStringFlags(formattedCode, NULL) == -1) {
2485
+ PyErr_SetString(
2486
+ PyExc_ImportError,
2487
+ "Runtime and compile-time PyObject size do not match."
2488
+ );
2489
+ return -1;
2490
+ }
2491
+ #endif
2492
+ return 0;
2493
+ }
2494
+
2495
+ ////////////////////////// SharedInFreeThreading.proto //////////////////
2496
+
2497
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2498
+ #define __Pyx_shared_in_cpython_freethreading(x) shared(x)
2499
+ #else
2500
+ #define __Pyx_shared_in_cpython_freethreading(x)
2501
+ #endif