Cython 3.1.0__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 (316) hide show
  1. Cython/Build/BuildExecutable.py +169 -0
  2. Cython/Build/Cache.py +199 -0
  3. Cython/Build/Cythonize.py +323 -0
  4. Cython/Build/Dependencies.py +1306 -0
  5. Cython/Build/Distutils.py +1 -0
  6. Cython/Build/Inline.py +463 -0
  7. Cython/Build/IpythonMagic.py +560 -0
  8. Cython/Build/SharedModule.py +76 -0
  9. Cython/Build/Tests/TestCyCache.py +194 -0
  10. Cython/Build/Tests/TestCythonizeArgsParser.py +481 -0
  11. Cython/Build/Tests/TestDependencies.py +133 -0
  12. Cython/Build/Tests/TestInline.py +177 -0
  13. Cython/Build/Tests/TestIpythonMagic.py +287 -0
  14. Cython/Build/Tests/TestRecythonize.py +212 -0
  15. Cython/Build/Tests/TestStripLiterals.py +155 -0
  16. Cython/Build/Tests/__init__.py +1 -0
  17. Cython/Build/__init__.py +8 -0
  18. Cython/CodeWriter.py +811 -0
  19. Cython/Compiler/AnalysedTreeTransforms.py +97 -0
  20. Cython/Compiler/Annotate.py +326 -0
  21. Cython/Compiler/AutoDocTransforms.py +320 -0
  22. Cython/Compiler/Buffer.py +680 -0
  23. Cython/Compiler/Builtin.py +934 -0
  24. Cython/Compiler/CmdLine.py +259 -0
  25. Cython/Compiler/Code.pxd +148 -0
  26. Cython/Compiler/Code.py +3375 -0
  27. Cython/Compiler/CodeGeneration.py +33 -0
  28. Cython/Compiler/CythonScope.py +187 -0
  29. Cython/Compiler/Dataclass.py +868 -0
  30. Cython/Compiler/DebugFlags.py +24 -0
  31. Cython/Compiler/Errors.py +295 -0
  32. Cython/Compiler/ExprNodes.py +15267 -0
  33. Cython/Compiler/FlowControl.pxd +97 -0
  34. Cython/Compiler/FlowControl.py +1455 -0
  35. Cython/Compiler/FusedNode.py +1002 -0
  36. Cython/Compiler/Future.py +16 -0
  37. Cython/Compiler/Interpreter.py +57 -0
  38. Cython/Compiler/Lexicon.py +340 -0
  39. Cython/Compiler/LineTable.py +114 -0
  40. Cython/Compiler/Main.py +853 -0
  41. Cython/Compiler/MatchCaseNodes.py +259 -0
  42. Cython/Compiler/MemoryView.py +922 -0
  43. Cython/Compiler/ModuleNode.py +4024 -0
  44. Cython/Compiler/Naming.py +374 -0
  45. Cython/Compiler/Nodes.py +10826 -0
  46. Cython/Compiler/Optimize.py +5256 -0
  47. Cython/Compiler/Options.py +835 -0
  48. Cython/Compiler/ParseTreeTransforms.pxd +77 -0
  49. Cython/Compiler/ParseTreeTransforms.py +4509 -0
  50. Cython/Compiler/Parsing.pxd +9 -0
  51. Cython/Compiler/Parsing.py +4789 -0
  52. Cython/Compiler/Pipeline.py +439 -0
  53. Cython/Compiler/PyrexTypes.py +5762 -0
  54. Cython/Compiler/Pythran.py +232 -0
  55. Cython/Compiler/Scanning.pxd +40 -0
  56. Cython/Compiler/Scanning.py +577 -0
  57. Cython/Compiler/StringEncoding.py +347 -0
  58. Cython/Compiler/Symtab.py +3080 -0
  59. Cython/Compiler/Tests/TestBuffer.py +105 -0
  60. Cython/Compiler/Tests/TestBuiltin.py +72 -0
  61. Cython/Compiler/Tests/TestCmdLine.py +586 -0
  62. Cython/Compiler/Tests/TestCode.py +86 -0
  63. Cython/Compiler/Tests/TestFlowControl.py +65 -0
  64. Cython/Compiler/Tests/TestGrammar.py +202 -0
  65. Cython/Compiler/Tests/TestMemView.py +71 -0
  66. Cython/Compiler/Tests/TestParseTreeTransforms.py +285 -0
  67. Cython/Compiler/Tests/TestScanning.py +134 -0
  68. Cython/Compiler/Tests/TestSignatureMatching.py +73 -0
  69. Cython/Compiler/Tests/TestStringEncoding.py +33 -0
  70. Cython/Compiler/Tests/TestTreeFragment.py +63 -0
  71. Cython/Compiler/Tests/TestTreePath.py +103 -0
  72. Cython/Compiler/Tests/TestTypes.py +75 -0
  73. Cython/Compiler/Tests/TestUtilityLoad.py +112 -0
  74. Cython/Compiler/Tests/TestVisitor.py +61 -0
  75. Cython/Compiler/Tests/Utils.py +36 -0
  76. Cython/Compiler/Tests/__init__.py +1 -0
  77. Cython/Compiler/TreeFragment.py +278 -0
  78. Cython/Compiler/TreePath.py +303 -0
  79. Cython/Compiler/TypeInference.py +584 -0
  80. Cython/Compiler/TypeSlots.py +1181 -0
  81. Cython/Compiler/UFuncs.py +311 -0
  82. Cython/Compiler/UtilNodes.py +389 -0
  83. Cython/Compiler/UtilityCode.py +344 -0
  84. Cython/Compiler/Version.py +8 -0
  85. Cython/Compiler/Visitor.pxd +53 -0
  86. Cython/Compiler/Visitor.py +861 -0
  87. Cython/Compiler/__init__.py +1 -0
  88. Cython/Coverage.py +448 -0
  89. Cython/Debugger/Cygdb.py +175 -0
  90. Cython/Debugger/DebugWriter.py +82 -0
  91. Cython/Debugger/Tests/TestLibCython.py +275 -0
  92. Cython/Debugger/Tests/__init__.py +1 -0
  93. Cython/Debugger/Tests/cfuncs.c +8 -0
  94. Cython/Debugger/Tests/codefile +49 -0
  95. Cython/Debugger/Tests/test_libcython_in_gdb.py +578 -0
  96. Cython/Debugger/Tests/test_libpython_in_gdb.py +90 -0
  97. Cython/Debugger/__init__.py +1 -0
  98. Cython/Debugger/libcython.py +1548 -0
  99. Cython/Debugger/libpython.py +2821 -0
  100. Cython/Debugging.py +20 -0
  101. Cython/Distutils/__init__.py +2 -0
  102. Cython/Distutils/build_ext.py +139 -0
  103. Cython/Distutils/extension.py +96 -0
  104. Cython/Distutils/old_build_ext.py +351 -0
  105. Cython/Includes/cpython/__init__.pxd +173 -0
  106. Cython/Includes/cpython/array.pxd +174 -0
  107. Cython/Includes/cpython/bool.pxd +37 -0
  108. Cython/Includes/cpython/buffer.pxd +112 -0
  109. Cython/Includes/cpython/bytearray.pxd +33 -0
  110. Cython/Includes/cpython/bytes.pxd +200 -0
  111. Cython/Includes/cpython/cellobject.pxd +35 -0
  112. Cython/Includes/cpython/ceval.pxd +8 -0
  113. Cython/Includes/cpython/codecs.pxd +121 -0
  114. Cython/Includes/cpython/complex.pxd +60 -0
  115. Cython/Includes/cpython/contextvars.pxd +145 -0
  116. Cython/Includes/cpython/conversion.pxd +36 -0
  117. Cython/Includes/cpython/datetime.pxd +395 -0
  118. Cython/Includes/cpython/descr.pxd +26 -0
  119. Cython/Includes/cpython/dict.pxd +187 -0
  120. Cython/Includes/cpython/exc.pxd +263 -0
  121. Cython/Includes/cpython/fileobject.pxd +57 -0
  122. Cython/Includes/cpython/float.pxd +47 -0
  123. Cython/Includes/cpython/function.pxd +65 -0
  124. Cython/Includes/cpython/genobject.pxd +25 -0
  125. Cython/Includes/cpython/getargs.pxd +12 -0
  126. Cython/Includes/cpython/instance.pxd +25 -0
  127. Cython/Includes/cpython/iterator.pxd +36 -0
  128. Cython/Includes/cpython/iterobject.pxd +24 -0
  129. Cython/Includes/cpython/list.pxd +92 -0
  130. Cython/Includes/cpython/long.pxd +149 -0
  131. Cython/Includes/cpython/longintrepr.pxd +14 -0
  132. Cython/Includes/cpython/mapping.pxd +63 -0
  133. Cython/Includes/cpython/marshal.pxd +66 -0
  134. Cython/Includes/cpython/mem.pxd +120 -0
  135. Cython/Includes/cpython/memoryview.pxd +50 -0
  136. Cython/Includes/cpython/method.pxd +49 -0
  137. Cython/Includes/cpython/module.pxd +208 -0
  138. Cython/Includes/cpython/number.pxd +258 -0
  139. Cython/Includes/cpython/object.pxd +433 -0
  140. Cython/Includes/cpython/pycapsule.pxd +143 -0
  141. Cython/Includes/cpython/pylifecycle.pxd +68 -0
  142. Cython/Includes/cpython/pyport.pxd +8 -0
  143. Cython/Includes/cpython/pystate.pxd +95 -0
  144. Cython/Includes/cpython/pythread.pxd +53 -0
  145. Cython/Includes/cpython/ref.pxd +67 -0
  146. Cython/Includes/cpython/sequence.pxd +134 -0
  147. Cython/Includes/cpython/set.pxd +119 -0
  148. Cython/Includes/cpython/slice.pxd +70 -0
  149. Cython/Includes/cpython/time.pxd +129 -0
  150. Cython/Includes/cpython/tuple.pxd +72 -0
  151. Cython/Includes/cpython/type.pxd +53 -0
  152. Cython/Includes/cpython/unicode.pxd +639 -0
  153. Cython/Includes/cpython/version.pxd +32 -0
  154. Cython/Includes/cpython/weakref.pxd +78 -0
  155. Cython/Includes/libc/__init__.pxd +1 -0
  156. Cython/Includes/libc/complex.pxd +35 -0
  157. Cython/Includes/libc/errno.pxd +127 -0
  158. Cython/Includes/libc/float.pxd +43 -0
  159. Cython/Includes/libc/limits.pxd +28 -0
  160. Cython/Includes/libc/locale.pxd +46 -0
  161. Cython/Includes/libc/math.pxd +209 -0
  162. Cython/Includes/libc/setjmp.pxd +10 -0
  163. Cython/Includes/libc/signal.pxd +64 -0
  164. Cython/Includes/libc/stddef.pxd +9 -0
  165. Cython/Includes/libc/stdint.pxd +105 -0
  166. Cython/Includes/libc/stdio.pxd +80 -0
  167. Cython/Includes/libc/stdlib.pxd +72 -0
  168. Cython/Includes/libc/string.pxd +50 -0
  169. Cython/Includes/libc/threads.pxd +84 -0
  170. Cython/Includes/libc/time.pxd +51 -0
  171. Cython/Includes/libcpp/__init__.pxd +4 -0
  172. Cython/Includes/libcpp/algorithm.pxd +320 -0
  173. Cython/Includes/libcpp/any.pxd +16 -0
  174. Cython/Includes/libcpp/atomic.pxd +59 -0
  175. Cython/Includes/libcpp/barrier.pxd +22 -0
  176. Cython/Includes/libcpp/bit.pxd +29 -0
  177. Cython/Includes/libcpp/cast.pxd +12 -0
  178. Cython/Includes/libcpp/cmath.pxd +518 -0
  179. Cython/Includes/libcpp/complex.pxd +106 -0
  180. Cython/Includes/libcpp/deque.pxd +165 -0
  181. Cython/Includes/libcpp/exception.pxd +86 -0
  182. Cython/Includes/libcpp/execution.pxd +15 -0
  183. Cython/Includes/libcpp/forward_list.pxd +63 -0
  184. Cython/Includes/libcpp/functional.pxd +26 -0
  185. Cython/Includes/libcpp/future.pxd +103 -0
  186. Cython/Includes/libcpp/iterator.pxd +34 -0
  187. Cython/Includes/libcpp/latch.pxd +17 -0
  188. Cython/Includes/libcpp/limits.pxd +61 -0
  189. Cython/Includes/libcpp/list.pxd +117 -0
  190. Cython/Includes/libcpp/map.pxd +252 -0
  191. Cython/Includes/libcpp/memory.pxd +115 -0
  192. Cython/Includes/libcpp/mutex.pxd +130 -0
  193. Cython/Includes/libcpp/numbers.pxd +15 -0
  194. Cython/Includes/libcpp/numeric.pxd +131 -0
  195. Cython/Includes/libcpp/optional.pxd +34 -0
  196. Cython/Includes/libcpp/pair.pxd +1 -0
  197. Cython/Includes/libcpp/queue.pxd +25 -0
  198. Cython/Includes/libcpp/random.pxd +166 -0
  199. Cython/Includes/libcpp/semaphore.pxd +44 -0
  200. Cython/Includes/libcpp/set.pxd +228 -0
  201. Cython/Includes/libcpp/shared_mutex.pxd +72 -0
  202. Cython/Includes/libcpp/span.pxd +87 -0
  203. Cython/Includes/libcpp/stack.pxd +11 -0
  204. Cython/Includes/libcpp/stop_token.pxd +105 -0
  205. Cython/Includes/libcpp/string.pxd +355 -0
  206. Cython/Includes/libcpp/string_view.pxd +181 -0
  207. Cython/Includes/libcpp/typeindex.pxd +15 -0
  208. Cython/Includes/libcpp/typeinfo.pxd +10 -0
  209. Cython/Includes/libcpp/unordered_map.pxd +193 -0
  210. Cython/Includes/libcpp/unordered_set.pxd +152 -0
  211. Cython/Includes/libcpp/utility.pxd +30 -0
  212. Cython/Includes/libcpp/vector.pxd +186 -0
  213. Cython/Includes/openmp.pxd +50 -0
  214. Cython/Includes/posix/__init__.pxd +1 -0
  215. Cython/Includes/posix/dlfcn.pxd +14 -0
  216. Cython/Includes/posix/fcntl.pxd +86 -0
  217. Cython/Includes/posix/ioctl.pxd +4 -0
  218. Cython/Includes/posix/mman.pxd +101 -0
  219. Cython/Includes/posix/resource.pxd +57 -0
  220. Cython/Includes/posix/select.pxd +21 -0
  221. Cython/Includes/posix/signal.pxd +73 -0
  222. Cython/Includes/posix/stat.pxd +98 -0
  223. Cython/Includes/posix/stdio.pxd +37 -0
  224. Cython/Includes/posix/stdlib.pxd +29 -0
  225. Cython/Includes/posix/strings.pxd +9 -0
  226. Cython/Includes/posix/time.pxd +71 -0
  227. Cython/Includes/posix/types.pxd +30 -0
  228. Cython/Includes/posix/uio.pxd +26 -0
  229. Cython/Includes/posix/unistd.pxd +271 -0
  230. Cython/Includes/posix/wait.pxd +38 -0
  231. Cython/Plex/Actions.pxd +24 -0
  232. Cython/Plex/Actions.py +119 -0
  233. Cython/Plex/DFA.pxd +14 -0
  234. Cython/Plex/DFA.py +164 -0
  235. Cython/Plex/Errors.py +48 -0
  236. Cython/Plex/Lexicons.py +178 -0
  237. Cython/Plex/Machines.pxd +36 -0
  238. Cython/Plex/Machines.py +238 -0
  239. Cython/Plex/Regexps.py +539 -0
  240. Cython/Plex/Scanners.pxd +47 -0
  241. Cython/Plex/Scanners.py +360 -0
  242. Cython/Plex/Transitions.pxd +14 -0
  243. Cython/Plex/Transitions.py +239 -0
  244. Cython/Plex/__init__.py +34 -0
  245. Cython/Runtime/__init__.py +1 -0
  246. Cython/Runtime/refnanny.pyx +237 -0
  247. Cython/Shadow.py +690 -0
  248. Cython/Shadow.pyi +521 -0
  249. Cython/StringIOTree.py +170 -0
  250. Cython/Tempita/__init__.py +4 -0
  251. Cython/Tempita/_looper.py +154 -0
  252. Cython/Tempita/_tempita.py +1091 -0
  253. Cython/TestUtils.py +410 -0
  254. Cython/Tests/TestCodeWriter.py +128 -0
  255. Cython/Tests/TestCythonUtils.py +202 -0
  256. Cython/Tests/TestJediTyper.py +223 -0
  257. Cython/Tests/TestShadow.py +114 -0
  258. Cython/Tests/TestStringIOTree.py +67 -0
  259. Cython/Tests/TestTestUtils.py +90 -0
  260. Cython/Tests/__init__.py +1 -0
  261. Cython/Tests/xmlrunner.py +390 -0
  262. Cython/Utility/AsyncGen.c +1002 -0
  263. Cython/Utility/Buffer.c +875 -0
  264. Cython/Utility/BufferFormatFromTypeInfo.pxd +2 -0
  265. Cython/Utility/Builtins.c +776 -0
  266. Cython/Utility/CConvert.pyx +134 -0
  267. Cython/Utility/CMath.c +104 -0
  268. Cython/Utility/CommonStructures.c +118 -0
  269. Cython/Utility/Complex.c +378 -0
  270. Cython/Utility/Coroutine.c +2206 -0
  271. Cython/Utility/CpdefEnums.pyx +103 -0
  272. Cython/Utility/CppConvert.pyx +279 -0
  273. Cython/Utility/CppSupport.cpp +143 -0
  274. Cython/Utility/CythonFunction.c +1794 -0
  275. Cython/Utility/Dataclasses.c +185 -0
  276. Cython/Utility/Dataclasses.py +112 -0
  277. Cython/Utility/Embed.c +125 -0
  278. Cython/Utility/Exceptions.c +1012 -0
  279. Cython/Utility/ExtensionTypes.c +809 -0
  280. Cython/Utility/FunctionArguments.c +965 -0
  281. Cython/Utility/ImportExport.c +987 -0
  282. Cython/Utility/Lock.c +136 -0
  283. Cython/Utility/MemoryView.pxd +187 -0
  284. Cython/Utility/MemoryView.pyx +1481 -0
  285. Cython/Utility/MemoryView_C.c +1046 -0
  286. Cython/Utility/ModuleSetupCode.c +3059 -0
  287. Cython/Utility/NumpyImportArray.c +46 -0
  288. Cython/Utility/ObjectHandling.c +3342 -0
  289. Cython/Utility/Optimize.c +1589 -0
  290. Cython/Utility/Overflow.c +404 -0
  291. Cython/Utility/Printing.c +86 -0
  292. Cython/Utility/Profile.c +709 -0
  293. Cython/Utility/StringTools.c +1259 -0
  294. Cython/Utility/TestCyUtilityLoader.pyx +8 -0
  295. Cython/Utility/TestCythonScope.pyx +75 -0
  296. Cython/Utility/TestUtilityLoader.c +12 -0
  297. Cython/Utility/TypeConversion.c +1284 -0
  298. Cython/Utility/UFuncs.pyx +50 -0
  299. Cython/Utility/UFuncs_C.c +89 -0
  300. Cython/Utility/__init__.py +28 -0
  301. Cython/Utility/arrayarray.h +148 -0
  302. Cython/Utils.py +687 -0
  303. Cython/__init__.py +10 -0
  304. Cython/__init__.pyi +7 -0
  305. Cython/py.typed +0 -0
  306. cython-3.1.0.dist-info/COPYING.txt +19 -0
  307. cython-3.1.0.dist-info/LICENSE.txt +176 -0
  308. cython-3.1.0.dist-info/METADATA +636 -0
  309. cython-3.1.0.dist-info/RECORD +316 -0
  310. cython-3.1.0.dist-info/WHEEL +5 -0
  311. cython-3.1.0.dist-info/entry_points.txt +4 -0
  312. cython-3.1.0.dist-info/top_level.txt +3 -0
  313. cython.py +29 -0
  314. pyximport/__init__.py +4 -0
  315. pyximport/pyxbuild.py +160 -0
  316. pyximport/pyximport.py +482 -0
@@ -0,0 +1,776 @@
1
+ /*
2
+ * Special implementations of built-in functions and methods.
3
+ *
4
+ * Optional optimisations for builtins are in Optimize.c.
5
+ *
6
+ * General object operations and protocols are in ObjectHandling.c.
7
+ */
8
+
9
+ //////////////////// Globals.proto ////////////////////
10
+
11
+ static PyObject* __Pyx_Globals(void); /*proto*/
12
+
13
+ //////////////////// Globals ////////////////////
14
+ //@requires: ObjectHandling.c::GetAttr
15
+
16
+ // This is a stub implementation until we have something more complete.
17
+ // Currently, we only handle the most common case of a read-only dict
18
+ // of Python names. Supporting cdef names in the module and write
19
+ // access requires a rewrite as a dedicated class.
20
+
21
+ static PyObject* __Pyx_Globals(void) {
22
+ return __Pyx_NewRef(NAMED_CGLOBAL(moddict_cname));
23
+ }
24
+
25
+ //////////////////// PyExecGlobals.proto ////////////////////
26
+
27
+ static PyObject* __Pyx_PyExecGlobals(PyObject*);
28
+
29
+ //////////////////// PyExecGlobals ////////////////////
30
+ //@requires: PyExec
31
+
32
+ static PyObject* __Pyx_PyExecGlobals(PyObject* code) {
33
+ return __Pyx_PyExec2(code, NAMED_CGLOBAL(moddict_cname));
34
+ }
35
+
36
+ //////////////////// PyExec.proto ////////////////////
37
+
38
+ static PyObject* __Pyx_PyExec3(PyObject*, PyObject*, PyObject*);
39
+ static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject*, PyObject*);
40
+
41
+ //////////////////// PyExec ////////////////////
42
+
43
+ static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject* o, PyObject* globals) {
44
+ return __Pyx_PyExec3(o, globals, NULL);
45
+ }
46
+
47
+ static PyObject* __Pyx_PyExec3(PyObject* o, PyObject* globals, PyObject* locals) {
48
+ PyObject* result;
49
+ #if !CYTHON_COMPILING_IN_LIMITED_API
50
+ PyObject* s = 0;
51
+ char *code = 0;
52
+ #endif
53
+
54
+ if (!globals || globals == Py_None) {
55
+ globals = NAMED_CGLOBAL(moddict_cname);
56
+ }
57
+ #if !CYTHON_COMPILING_IN_LIMITED_API
58
+ // In Limited API we just use exec builtin which already has this
59
+ else if (unlikely(!PyDict_Check(globals))) {
60
+ __Pyx_TypeName globals_type_name =
61
+ __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(globals));
62
+ PyErr_Format(PyExc_TypeError,
63
+ "exec() arg 2 must be a dict, not " __Pyx_FMT_TYPENAME,
64
+ globals_type_name);
65
+ __Pyx_DECREF_TypeName(globals_type_name);
66
+ goto bad;
67
+ }
68
+ #endif
69
+ if (!locals || locals == Py_None) {
70
+ locals = globals;
71
+ }
72
+
73
+ #if !CYTHON_COMPILING_IN_LIMITED_API
74
+ if (__Pyx_PyDict_GetItemStr(globals, PYIDENT("__builtins__")) == NULL) {
75
+ if (unlikely(PyDict_SetItem(globals, PYIDENT("__builtins__"), PyEval_GetBuiltins()) < 0))
76
+ goto bad;
77
+ }
78
+
79
+ if (PyCode_Check(o)) {
80
+ if (unlikely(__Pyx_PyCode_HasFreeVars((PyCodeObject *)o))) {
81
+ PyErr_SetString(PyExc_TypeError,
82
+ "code object passed to exec() may not contain free variables");
83
+ goto bad;
84
+ }
85
+ #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400
86
+ result = PyEval_EvalCode((PyCodeObject *)o, globals, locals);
87
+ #else
88
+ result = PyEval_EvalCode(o, globals, locals);
89
+ #endif
90
+ } else {
91
+ PyCompilerFlags cf;
92
+ cf.cf_flags = 0;
93
+ #if PY_VERSION_HEX >= 0x030800A3
94
+ cf.cf_feature_version = PY_MINOR_VERSION;
95
+ #endif
96
+ if (PyUnicode_Check(o)) {
97
+ cf.cf_flags = PyCF_SOURCE_IS_UTF8;
98
+ s = PyUnicode_AsUTF8String(o);
99
+ if (unlikely(!s)) goto bad;
100
+ o = s;
101
+ } else if (unlikely(!PyBytes_Check(o))) {
102
+ __Pyx_TypeName o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
103
+ PyErr_Format(PyExc_TypeError,
104
+ "exec: arg 1 must be string, bytes or code object, got " __Pyx_FMT_TYPENAME,
105
+ o_type_name);
106
+ __Pyx_DECREF_TypeName(o_type_name);
107
+ goto bad;
108
+ }
109
+ code = PyBytes_AS_STRING(o);
110
+ if (PyEval_MergeCompilerFlags(&cf)) {
111
+ result = PyRun_StringFlags(code, Py_file_input, globals, locals, &cf);
112
+ } else {
113
+ result = PyRun_String(code, Py_file_input, globals, locals);
114
+ }
115
+ Py_XDECREF(s);
116
+ }
117
+
118
+ return result;
119
+ bad:
120
+ Py_XDECREF(s);
121
+ return 0;
122
+ #else // CYTHON_COMPILING_IN_LIMITED_API
123
+ {
124
+ // For the limited API we just defer to the actual builtin
125
+ // (after setting up globals and locals) - there's too much we can't do otherwise
126
+ PyObject *builtins, *exec, *exec_str;
127
+ builtins = PyEval_GetBuiltins();
128
+ if (!builtins) return NULL;
129
+ exec_str = PyUnicode_FromStringAndSize("exec", 4);
130
+ if (!exec_str) return NULL;
131
+ exec = PyObject_GetItem(builtins, exec_str);
132
+ Py_DECREF(exec_str);
133
+ if (!exec) return NULL;
134
+ result = PyObject_CallFunctionObjArgs(exec, o, globals, locals, NULL);
135
+ Py_DECREF(exec);
136
+ return result;
137
+ }
138
+ #endif
139
+ }
140
+
141
+ //////////////////// GetAttr3.proto ////////////////////
142
+
143
+ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
144
+
145
+ //////////////////// GetAttr3 ////////////////////
146
+ //@requires: ObjectHandling.c::PyObjectGetAttrStr
147
+ //@requires: Exceptions.c::PyThreadStateGet
148
+ //@requires: Exceptions.c::PyErrFetchRestore
149
+ //@requires: Exceptions.c::PyErrExceptionMatches
150
+
151
+ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
152
+ static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
153
+ __Pyx_PyThreadState_declare
154
+ __Pyx_PyThreadState_assign
155
+ if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
156
+ return NULL;
157
+ __Pyx_PyErr_Clear();
158
+ Py_INCREF(d);
159
+ return d;
160
+ }
161
+ #endif
162
+
163
+ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
164
+ PyObject *r;
165
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
166
+ int res = PyObject_GetOptionalAttr(o, n, &r);
167
+ // On failure (res == -1), r is set to NULL.
168
+ return (res != 0) ? r : __Pyx_NewRef(d);
169
+ #else
170
+ #if CYTHON_USE_TYPE_SLOTS
171
+ if (likely(PyUnicode_Check(n))) {
172
+ r = __Pyx_PyObject_GetAttrStrNoError(o, n);
173
+ if (unlikely(!r) && likely(!PyErr_Occurred())) {
174
+ r = __Pyx_NewRef(d);
175
+ }
176
+ return r;
177
+ }
178
+ #endif
179
+ r = PyObject_GetAttr(o, n);
180
+ return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
181
+ #endif
182
+ }
183
+
184
+ //////////////////// HasAttr.proto ////////////////////
185
+
186
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
187
+ #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
188
+ #else
189
+ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /*proto*/
190
+ #endif
191
+
192
+ //////////////////// HasAttr ////////////////////
193
+ //@requires: ObjectHandling.c::PyObjectGetAttrStrNoError
194
+
195
+ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
196
+ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
197
+ PyObject *r;
198
+ if (unlikely(!PyUnicode_Check(n))) {
199
+ PyErr_SetString(PyExc_TypeError,
200
+ "hasattr(): attribute name must be string");
201
+ return -1;
202
+ }
203
+ r = __Pyx_PyObject_GetAttrStrNoError(o, n);
204
+ if (!r) {
205
+ return (unlikely(PyErr_Occurred())) ? -1 : 0;
206
+ } else {
207
+ Py_DECREF(r);
208
+ return 1;
209
+ }
210
+ }
211
+ #endif
212
+
213
+ //////////////////// Intern.proto ////////////////////
214
+
215
+ static PyObject* __Pyx_Intern(PyObject* s); /* proto */
216
+
217
+ //////////////////// Intern ////////////////////
218
+ //@requires: ObjectHandling.c::RaiseUnexpectedTypeError
219
+
220
+ static PyObject* __Pyx_Intern(PyObject* s) {
221
+ if (unlikely(!PyUnicode_CheckExact(s))) {
222
+ __Pyx_RaiseUnexpectedTypeError("str", s);
223
+ return NULL;
224
+ }
225
+ Py_INCREF(s);
226
+ PyUnicode_InternInPlace(&s);
227
+ return s;
228
+ }
229
+
230
+ //////////////////// abs_longlong.proto ////////////////////
231
+
232
+ static CYTHON_INLINE PY_LONG_LONG __Pyx_abs_longlong(PY_LONG_LONG x) {
233
+ #if defined (__cplusplus) && __cplusplus >= 201103L
234
+ return std::abs(x);
235
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
236
+ return llabs(x);
237
+ #elif defined (_MSC_VER)
238
+ // abs() is defined for long, but 64-bits type on MSVC is long long.
239
+ // Use MS-specific _abs64() instead, which returns the original (negative) value for abs(-MAX-1)
240
+ return _abs64(x);
241
+ #elif defined (__GNUC__)
242
+ // gcc or clang on 64 bit windows.
243
+ return __builtin_llabs(x);
244
+ #else
245
+ if (sizeof(PY_LONG_LONG) <= sizeof(Py_ssize_t))
246
+ return __Pyx_sst_abs(x);
247
+ return (x<0) ? -x : x;
248
+ #endif
249
+ }
250
+
251
+
252
+ //////////////////// py_abs.proto ////////////////////
253
+
254
+ #if CYTHON_USE_PYLONG_INTERNALS
255
+ static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);/*proto*/
256
+
257
+ #define __Pyx_PyNumber_Absolute(x) \
258
+ ((likely(PyLong_CheckExact(x))) ? \
259
+ (likely(__Pyx_PyLong_IsNonNeg(x)) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) : \
260
+ PyNumber_Absolute(x))
261
+
262
+ #else
263
+ #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
264
+ #endif
265
+
266
+ //////////////////// py_abs ////////////////////
267
+
268
+ #if CYTHON_USE_PYLONG_INTERNALS
269
+ static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
270
+ #if PY_VERSION_HEX >= 0x030C00A7
271
+ if (likely(__Pyx_PyLong_IsCompact(n))) {
272
+ return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
273
+ }
274
+ #else
275
+ if (likely(Py_SIZE(n) == -1)) {
276
+ // digits are unsigned
277
+ return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
278
+ }
279
+ #endif
280
+ #if CYTHON_COMPILING_IN_CPYTHON
281
+ {
282
+ PyObject *copy = _PyLong_Copy((PyLongObject*)n);
283
+ if (likely(copy)) {
284
+ #if PY_VERSION_HEX >= 0x030C00A7
285
+ // clear the sign bits to set the sign from SIGN_NEGATIVE (2) to positive (0)
286
+ ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
287
+ #else
288
+ // negate the size to swap the sign
289
+ __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
290
+ #endif
291
+ }
292
+ return copy;
293
+ }
294
+ #else
295
+ return PyNumber_Negative(n);
296
+ #endif
297
+ }
298
+ #endif
299
+
300
+
301
+ //////////////////// pow2.proto ////////////////////
302
+
303
+ #define __Pyx_PyNumber_Power2(a, b) PyNumber_Power(a, b, Py_None)
304
+
305
+
306
+ //////////////////// divmod_int.proto //////////////////
307
+
308
+ const {{RETURN_TYPE}} __Pyx_divmod_ERROR_VALUE_{{CFUNC_SUFFIX}} = {-1, -1};
309
+
310
+ static CYTHON_INLINE {{RETURN_TYPE}} __Pyx_divmod_{{CFUNC_SUFFIX}}({{TYPE}} a, {{TYPE}} b); /*proto*/
311
+
312
+
313
+ //////////////////// divmod_int //////////////////
314
+
315
+ static CYTHON_INLINE {{RETURN_TYPE}} __Pyx_divmod_{{CFUNC_SUFFIX}}({{TYPE}} a, {{TYPE}} b) {
316
+ // Python and C/C++ use different algorithms in calculating quotients and remainders.
317
+ // This results in different answers between Python and C/C++
318
+ // when the dividend is negative and the divisor is positive and vice versa.
319
+ {{TYPE}} q, r;
320
+ if (unlikely(b == 0)) {
321
+ {{if NOGIL}}PyGILState_STATE gilstate = PyGILState_Ensure();{{endif}}
322
+ PyErr_SetString(PyExc_ZeroDivisionError, "division by zero");
323
+ {{if NOGIL}}PyGILState_Release(gilstate);{{endif}}
324
+ return __Pyx_divmod_ERROR_VALUE_{{CFUNC_SUFFIX}};
325
+ } else if (a == 0) {
326
+ q = 0;
327
+ r = 0;
328
+ } else if ((a < 0) != (b < 0)) {
329
+ // see CMath.c :: DivInt and ModInt utility code
330
+ q = a / b;
331
+ r = a - q * b;
332
+ {{TYPE}} adapt_python = ((r != 0) & ((r < 0) ^ (b < 0)));
333
+ q -= adapt_python;
334
+ r += adapt_python * b;
335
+ }
336
+ else {
337
+ q = a / b;
338
+ r = a % b;
339
+ }
340
+
341
+ {{RETURN_TYPE}} c_result = {q, r};
342
+ return c_result;
343
+ }
344
+
345
+
346
+ //////////////////// divmod_float.proto //////////////////
347
+
348
+ const {{RETURN_TYPE}} __Pyx_divmod_ERROR_VALUE_{{CFUNC_SUFFIX}} = {-1.0, -1.0};
349
+
350
+ static CYTHON_INLINE {{RETURN_TYPE}} __Pyx_divmod_{{CFUNC_SUFFIX}}({{TYPE}} a, {{TYPE}} b); /*proto*/
351
+
352
+
353
+ //////////////////// divmod_float //////////////////
354
+
355
+ static CYTHON_INLINE {{RETURN_TYPE}} __Pyx_divmod_{{CFUNC_SUFFIX}}({{TYPE}} a, {{TYPE}} b) {
356
+ // Python and C/C++ use different algorithms in calculating quotients and remainders.
357
+ // This results in different answers between Python and C/C++
358
+ // when the dividend is negative and the divisor is positive and vice versa.
359
+
360
+ // Adapted from CPython 3.14: floatobject.c / _float_div_mod()
361
+
362
+ {{TYPE}} q, r, div;
363
+
364
+ if (unlikely(b == 0.0)) {
365
+ {{if NOGIL}}PyGILState_STATE gilstate = PyGILState_Ensure();{{endif}}
366
+ PyErr_SetString(PyExc_ZeroDivisionError, "division by zero");
367
+ {{if NOGIL}}PyGILState_Release(gilstate);{{endif}}
368
+ return __Pyx_divmod_ERROR_VALUE_{{CFUNC_SUFFIX}};
369
+ }
370
+
371
+ r = fmod{{MATH_SUFFIX}}(a, b);
372
+ // fmod is typically exact, so a-mod is *mathematically* an
373
+ // exact multiple of b. But this is fp arithmetic, and fp
374
+ // a - mod is an approximation; the result is that div may
375
+ // not be an exact integral value after the division, although
376
+ // it will always be very close to one.
377
+ div = (a - r) / b;
378
+ if (r) {
379
+ // ensure the remainder has the same sign as the denominator
380
+ if ((b < 0) != (r < 0)) {
381
+ r += b;
382
+ div -= 1.0;
383
+ }
384
+ }
385
+ else {
386
+ // the remainder is zero, and in the presence of signed zeroes
387
+ // fmod returns different results across platforms; ensure
388
+ // it has the same sign as the denominator.
389
+ r = copysign{{MATH_SUFFIX}}(0.0, b);
390
+ }
391
+ // snap quotient to nearest integral value
392
+ if (div) {
393
+ q = floor{{MATH_SUFFIX}}(div);
394
+ if (div - q > 0.5) {
395
+ q += 1.0;
396
+ }
397
+ }
398
+ else {
399
+ // div is zero - get the same sign as the true quotient
400
+ q = copysign{{MATH_SUFFIX}}(0.0, a / b); /* zero w/ sign of a/b */
401
+ }
402
+
403
+ {{RETURN_TYPE}} c_result = {q, r};
404
+ return c_result;
405
+ }
406
+
407
+
408
+ //////////////////// int_pyucs4.proto ////////////////////
409
+
410
+ static CYTHON_INLINE int __Pyx_int_from_UCS4(Py_UCS4 uchar);
411
+
412
+ //////////////////// int_pyucs4 ////////////////////
413
+
414
+ static int __Pyx_int_from_UCS4(Py_UCS4 uchar) {
415
+ // Fast path for ascii digits
416
+ if (likely(uchar >= (Py_UCS4)'0' && uchar <= (Py_UCS4)'9')) {
417
+ return uchar - (Py_UCS4)'0';
418
+ }
419
+ #if CYTHON_COMPILING_IN_LIMITED_API
420
+ PyObject *u = PyUnicode_FromOrdinal(uchar);
421
+ if (unlikely(!u)) return -1;
422
+ PyObject *l = PyObject_CallFunctionObjArgs((PyObject*)(&PyLong_Type), u, NULL);
423
+ Py_DECREF(u);
424
+ if (unlikely(!l)) return -1;
425
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
426
+ int result = PyLong_AsInt(l);
427
+ #else
428
+ // just don't handle overflow - it's very difficult to see how we'll get it from
429
+ // a single digit.
430
+ int result = (int)PyLong_AsLong(l);
431
+ #endif
432
+ Py_DECREF(l);
433
+ return result;
434
+ #else
435
+ int digit = Py_UNICODE_TODECIMAL(uchar);
436
+ if (unlikely(digit < 0)) {
437
+ PyErr_Format(PyExc_ValueError,
438
+ "invalid literal for int() with base 10: '%c'",
439
+ (int) uchar);
440
+ return -1;
441
+ }
442
+ return digit;
443
+ #endif
444
+ }
445
+
446
+
447
+ //////////////////// float_pyucs4.proto ////////////////////
448
+
449
+ static CYTHON_INLINE double __Pyx_double_from_UCS4(Py_UCS4 uchar);
450
+
451
+ //////////////////// float_pyucs4 ////////////////////
452
+
453
+ static double __Pyx_double_from_UCS4(Py_UCS4 uchar) {
454
+ // fast path for "just an ascii digit"
455
+ if (likely(uchar >= (Py_UCS4)'0' && uchar <= (Py_UCS4)'9')) {
456
+ return uchar - (Py_UCS4)'0';
457
+ }
458
+ #if CYTHON_COMPILING_IN_LIMITED_API
459
+ PyObject *u = PyUnicode_FromOrdinal(uchar);
460
+ if (unlikely(!u)) return -1.0;
461
+ PyObject *f = PyFloat_FromString(u);
462
+ Py_DECREF(u);
463
+ if (unlikely(!f)) return -1.0;
464
+ double result = PyFloat_AsDouble(f);
465
+ Py_DECREF(f);
466
+ return result;
467
+ #else
468
+ // ...TONUMERIC would initially seem to be a better fit.
469
+ // However, that accepts things like the "half" symbol, while
470
+ // float(string) rejects those.
471
+ double digit = Py_UNICODE_TODECIMAL(uchar);
472
+ if (unlikely(digit < 0.0)) {
473
+ PyErr_Format(PyExc_ValueError,
474
+ "could not convert string to float: '%c'",
475
+ (int) uchar);
476
+ return -1.0;
477
+ }
478
+ return digit;
479
+ #endif
480
+ }
481
+
482
+
483
+ //////////////////// object_ord.proto ////////////////////
484
+ //@requires: TypeConversion.c::UnicodeAsUCS4
485
+
486
+ #define __Pyx_PyObject_Ord(c) \
487
+ (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c))
488
+ static long __Pyx__PyObject_Ord(PyObject* c); /*proto*/
489
+
490
+ //////////////////// object_ord ////////////////////
491
+
492
+ static long __Pyx__PyObject_Ord(PyObject* c) {
493
+ Py_ssize_t size;
494
+ if (PyBytes_Check(c)) {
495
+ size = __Pyx_PyBytes_GET_SIZE(c);
496
+ if (likely(size == 1)) {
497
+ #if CYTHON_ASSUME_SAFE_MACROS
498
+ return (unsigned char) PyBytes_AS_STRING(c)[0];
499
+ #else
500
+ char *data = PyBytes_AsString(c);
501
+ if (unlikely(!data)) return -1;
502
+ return (unsigned char) data[0];
503
+ #endif
504
+ }
505
+ #if !CYTHON_ASSUME_SAFE_SIZE
506
+ else if (unlikely(size < 0)) return -1;
507
+ #endif
508
+ } else if (PyByteArray_Check(c)) {
509
+ size = __Pyx_PyByteArray_GET_SIZE(c);
510
+ if (likely(size == 1)) {
511
+ #if CYTHON_ASSUME_SAFE_MACROS
512
+ return (unsigned char) PyByteArray_AS_STRING(c)[0];
513
+ #else
514
+ char *data = PyByteArray_AsString(c);
515
+ if (unlikely(!data)) return -1;
516
+ return (unsigned char) data[0];
517
+ #endif
518
+ }
519
+ #if !CYTHON_ASSUME_SAFE_SIZE
520
+ else if (unlikely(size < 0)) return -1;
521
+ #endif
522
+ } else {
523
+ // FIXME: support character buffers - but CPython doesn't support them either
524
+ __Pyx_TypeName c_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(c));
525
+ PyErr_Format(PyExc_TypeError,
526
+ "ord() expected string of length 1, but " __Pyx_FMT_TYPENAME " found",
527
+ c_type_name);
528
+ __Pyx_DECREF_TypeName(c_type_name);
529
+ return (long)(Py_UCS4)-1;
530
+ }
531
+ PyErr_Format(PyExc_TypeError,
532
+ "ord() expected a character, but string of length %zd found", size);
533
+ return (long)(Py_UCS4)-1;
534
+ }
535
+
536
+
537
+ //////////////////// py_dict_keys.proto ////////////////////
538
+
539
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); /*proto*/
540
+
541
+ //////////////////// py_dict_keys ////////////////////
542
+
543
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
544
+ return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
545
+ }
546
+
547
+ //////////////////// py_dict_values.proto ////////////////////
548
+
549
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /*proto*/
550
+
551
+ //////////////////// py_dict_values ////////////////////
552
+
553
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
554
+ return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
555
+ }
556
+
557
+ //////////////////// py_dict_items.proto ////////////////////
558
+
559
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/
560
+
561
+ //////////////////// py_dict_items ////////////////////
562
+
563
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
564
+ return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
565
+ }
566
+
567
+ //////////////////// py_dict_iterkeys.proto ////////////////////
568
+
569
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterKeys(PyObject* d); /*proto*/
570
+
571
+ //////////////////// py_dict_iterkeys ////////////////////
572
+
573
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterKeys(PyObject* d) {
574
+ return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
575
+ }
576
+
577
+ //////////////////// py_dict_itervalues.proto ////////////////////
578
+
579
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterValues(PyObject* d); /*proto*/
580
+
581
+ //////////////////// py_dict_itervalues ////////////////////
582
+
583
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterValues(PyObject* d) {
584
+ return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
585
+ }
586
+
587
+ //////////////////// py_dict_iteritems.proto ////////////////////
588
+
589
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterItems(PyObject* d); /*proto*/
590
+
591
+ //////////////////// py_dict_iteritems ////////////////////
592
+
593
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterItems(PyObject* d) {
594
+ return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
595
+ }
596
+
597
+ //////////////////// py_dict_viewkeys.proto ////////////////////
598
+
599
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewKeys(PyObject* d); /*proto*/
600
+
601
+ //////////////////// py_dict_viewkeys ////////////////////
602
+
603
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewKeys(PyObject* d) {
604
+ return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
605
+ }
606
+
607
+ //////////////////// py_dict_viewvalues.proto ////////////////////
608
+
609
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewValues(PyObject* d); /*proto*/
610
+
611
+ //////////////////// py_dict_viewvalues ////////////////////
612
+
613
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewValues(PyObject* d) {
614
+ return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
615
+ }
616
+
617
+ //////////////////// py_dict_viewitems.proto ////////////////////
618
+
619
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewItems(PyObject* d); /*proto*/
620
+
621
+ //////////////////// py_dict_viewitems ////////////////////
622
+
623
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewItems(PyObject* d) {
624
+ return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
625
+ }
626
+
627
+
628
+ //////////////////// pyfrozenset_new.proto ////////////////////
629
+
630
+ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
631
+
632
+ //////////////////// pyfrozenset_new ////////////////////
633
+ //@requires: ObjectHandling.c::PyObjectCallNoArg
634
+
635
+ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
636
+ if (it) {
637
+ PyObject* result;
638
+ #if CYTHON_COMPILING_IN_PYPY
639
+ // PyPy currently lacks PyFrozenSet_CheckExact() and PyFrozenSet_New()
640
+ PyObject* args;
641
+ args = PyTuple_Pack(1, it);
642
+ if (unlikely(!args))
643
+ return NULL;
644
+ result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
645
+ Py_DECREF(args);
646
+ return result;
647
+ #else
648
+ if (PyFrozenSet_CheckExact(it)) {
649
+ Py_INCREF(it);
650
+ return it;
651
+ }
652
+ result = PyFrozenSet_New(it);
653
+ if (unlikely(!result))
654
+ return NULL;
655
+ if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
656
+ #if CYTHON_COMPILING_IN_LIMITED_API
657
+ || __Pyx_get_runtime_version() >= 0x030A0000
658
+ #endif
659
+ )
660
+ return result;
661
+ {
662
+ Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
663
+ if (likely(size > 0))
664
+ return result;
665
+ #if !CYTHON_ASSUME_SAFE_SIZE
666
+ if (unlikely(size < 0)) {
667
+ Py_DECREF(result);
668
+ return NULL;
669
+ }
670
+ #endif
671
+ }
672
+ // empty frozenset is a singleton (on Python <3.10)
673
+ // seems wasteful, but CPython does the same
674
+ Py_DECREF(result);
675
+ #endif
676
+ }
677
+ return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
678
+ }
679
+
680
+
681
+ //////////////////// PySet_Update.proto ////////////////////
682
+
683
+ static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it); /*proto*/
684
+
685
+ //////////////////// PySet_Update ////////////////////
686
+
687
+ static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it) {
688
+ PyObject *retval;
689
+ #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
690
+ if (PyAnySet_Check(it)) {
691
+ Py_ssize_t size = __Pyx_PySet_GET_SIZE(it);
692
+ #if !CYTHON_ASSUME_SAFE_SIZE
693
+ if (unlikely(size < 0)) return -1;
694
+ #endif
695
+ if (size == 0)
696
+ return 0;
697
+ // fast and safe case: CPython will update our result set and return it
698
+ retval = PySet_Type.tp_as_number->nb_inplace_or(set, it);
699
+ if (likely(retval == set)) {
700
+ Py_DECREF(retval);
701
+ return 0;
702
+ }
703
+ if (unlikely(!retval))
704
+ return -1;
705
+ // unusual result, fall through to set.update() call below
706
+ Py_DECREF(retval);
707
+ }
708
+ #endif
709
+ retval = CALL_UNBOUND_METHOD(PySet_Type, "update", set, it);
710
+ if (unlikely(!retval)) return -1;
711
+ Py_DECREF(retval);
712
+ return 0;
713
+ }
714
+
715
+ ///////////////// memoryview_get_from_buffer.proto ////////////////////
716
+
717
+ #if !CYTHON_COMPILING_IN_LIMITED_API
718
+ #define __Pyx_PyMemoryView_Get_{{name}}(o) PyMemoryView_GET_BUFFER(o)->{{name}}
719
+ #else
720
+ {{py:
721
+ out_types = dict(
722
+ ndim='int', readonly='int',
723
+ len='Py_ssize_t', itemsize='Py_ssize_t')
724
+ }} // can't get format like this unfortunately. It's unicode via getattr
725
+ {{py: out_type = out_types[name]}}
726
+ static {{out_type}} __Pyx_PyMemoryView_Get_{{name}}(PyObject *obj); /* proto */
727
+ #endif
728
+
729
+ ////////////// memoryview_get_from_buffer /////////////////////////
730
+
731
+ #if !CYTHON_COMPILING_IN_LIMITED_API
732
+ #else
733
+ {{py:
734
+ out_types = dict(
735
+ ndim='int', readonly='int',
736
+ len='Py_ssize_t', itemsize='Py_ssize_t')
737
+ }}
738
+ {{py: out_type = out_types[name]}}
739
+ static {{out_type}} __Pyx_PyMemoryView_Get_{{name}}(PyObject *obj) {
740
+ {{out_type}} result;
741
+ PyObject *attr = PyObject_GetAttr(obj, PYIDENT("{{name}}"));
742
+ if (!attr) {
743
+ goto bad;
744
+ }
745
+ {{if out_type == 'int'}}
746
+ // I'm not worrying about overflow here because
747
+ // ultimately it comes from a C struct that's an int
748
+ result = PyLong_AsLong(attr);
749
+ {{elif out_type == 'Py_ssize_t'}}
750
+ result = PyLong_AsSsize_t(attr);
751
+ {{endif}}
752
+ Py_DECREF(attr);
753
+ return result;
754
+
755
+ bad:
756
+ Py_XDECREF(attr);
757
+ return -1;
758
+ }
759
+ #endif
760
+
761
+ ////////////// PySliceAccessors.proto /////////////////////////
762
+
763
+ #if CYTHON_COMPILING_IN_LIMITED_API
764
+ #define __Pyx_PySlice_Start(o) PyObject_GetAttr(o, PYIDENT("start"))
765
+ #define __Pyx_PySlice_Stop(o) PyObject_GetAttr(o, PYIDENT("stop"))
766
+ #define __Pyx_PySlice_Step(o) PyObject_GetAttr(o, PYIDENT("step"))
767
+ #elif CYTHON_COMPILING_IN_GRAAL
768
+ // Graal defines it's own accessor functions
769
+ #define __Pyx_PySlice_Start(o) __Pyx_NewRef(PySlice_Start((PySliceObject*)o))
770
+ #define __Pyx_PySlice_Stop(o) __Pyx_NewRef(PySlice_Stop((PySliceObject*)o))
771
+ #define __Pyx_PySlice_Step(o) __Pyx_NewRef(PySlice_Step((PySliceObject*)o))
772
+ #else
773
+ #define __Pyx_PySlice_Start(o) __Pyx_NewRef(((PySliceObject*)o)->start)
774
+ #define __Pyx_PySlice_Stop(o) __Pyx_NewRef(((PySliceObject*)o)->stop)
775
+ #define __Pyx_PySlice_Step(o) __Pyx_NewRef(((PySliceObject*)o)->step)
776
+ #endif