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,660 @@
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_GetName(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_GetName(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;
127
+ builtins = PyEval_GetBuiltins();
128
+ if (!builtins) return NULL;
129
+ exec = PyDict_GetItemString(builtins, "exec");
130
+ if (!exec) return NULL;
131
+ result = PyObject_CallFunctionObjArgs(exec, o, globals, locals, NULL);
132
+ return result;
133
+ }
134
+ #endif
135
+ }
136
+
137
+ //////////////////// GetAttr3.proto ////////////////////
138
+
139
+ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
140
+
141
+ //////////////////// GetAttr3 ////////////////////
142
+ //@requires: ObjectHandling.c::PyObjectGetAttrStr
143
+ //@requires: Exceptions.c::PyThreadStateGet
144
+ //@requires: Exceptions.c::PyErrFetchRestore
145
+ //@requires: Exceptions.c::PyErrExceptionMatches
146
+
147
+ #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
148
+ static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
149
+ __Pyx_PyThreadState_declare
150
+ __Pyx_PyThreadState_assign
151
+ if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
152
+ return NULL;
153
+ __Pyx_PyErr_Clear();
154
+ Py_INCREF(d);
155
+ return d;
156
+ }
157
+ #endif
158
+
159
+ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
160
+ PyObject *r;
161
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
162
+ int res = PyObject_GetOptionalAttr(o, n, &r);
163
+ // On failure (res == -1), r is set to NULL.
164
+ return (res != 0) ? r : __Pyx_NewRef(d);
165
+ #else
166
+ #if CYTHON_USE_TYPE_SLOTS
167
+ if (likely(PyUnicode_Check(n))) {
168
+ r = __Pyx_PyObject_GetAttrStrNoError(o, n);
169
+ if (unlikely(!r) && likely(!PyErr_Occurred())) {
170
+ r = __Pyx_NewRef(d);
171
+ }
172
+ return r;
173
+ }
174
+ #endif
175
+ r = PyObject_GetAttr(o, n);
176
+ return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
177
+ #endif
178
+ }
179
+
180
+ //////////////////// HasAttr.proto ////////////////////
181
+
182
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
183
+ #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
184
+ #else
185
+ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /*proto*/
186
+ #endif
187
+
188
+ //////////////////// HasAttr ////////////////////
189
+ //@requires: ObjectHandling.c::PyObjectGetAttrStrNoError
190
+
191
+ #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
192
+ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
193
+ PyObject *r;
194
+ if (unlikely(!PyUnicode_Check(n))) {
195
+ PyErr_SetString(PyExc_TypeError,
196
+ "hasattr(): attribute name must be string");
197
+ return -1;
198
+ }
199
+ r = __Pyx_PyObject_GetAttrStrNoError(o, n);
200
+ if (!r) {
201
+ return (unlikely(PyErr_Occurred())) ? -1 : 0;
202
+ } else {
203
+ Py_DECREF(r);
204
+ return 1;
205
+ }
206
+ }
207
+ #endif
208
+
209
+ //////////////////// Intern.proto ////////////////////
210
+
211
+ static PyObject* __Pyx_Intern(PyObject* s); /* proto */
212
+
213
+ //////////////////// Intern ////////////////////
214
+ //@requires: ObjectHandling.c::RaiseUnexpectedTypeError
215
+
216
+ static PyObject* __Pyx_Intern(PyObject* s) {
217
+ if (unlikely(!PyUnicode_CheckExact(s))) {
218
+ __Pyx_RaiseUnexpectedTypeError("str", s);
219
+ return NULL;
220
+ }
221
+ Py_INCREF(s);
222
+ PyUnicode_InternInPlace(&s);
223
+ return s;
224
+ }
225
+
226
+ //////////////////// abs_longlong.proto ////////////////////
227
+
228
+ static CYTHON_INLINE PY_LONG_LONG __Pyx_abs_longlong(PY_LONG_LONG x) {
229
+ #if defined (__cplusplus) && __cplusplus >= 201103L
230
+ return std::abs(x);
231
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
232
+ return llabs(x);
233
+ #elif defined (_MSC_VER)
234
+ // abs() is defined for long, but 64-bits type on MSVC is long long.
235
+ // Use MS-specific _abs64() instead, which returns the original (negative) value for abs(-MAX-1)
236
+ return _abs64(x);
237
+ #elif defined (__GNUC__)
238
+ // gcc or clang on 64 bit windows.
239
+ return __builtin_llabs(x);
240
+ #else
241
+ if (sizeof(PY_LONG_LONG) <= sizeof(Py_ssize_t))
242
+ return __Pyx_sst_abs(x);
243
+ return (x<0) ? -x : x;
244
+ #endif
245
+ }
246
+
247
+
248
+ //////////////////// py_abs.proto ////////////////////
249
+
250
+ #if CYTHON_USE_PYLONG_INTERNALS
251
+ static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);/*proto*/
252
+
253
+ #define __Pyx_PyNumber_Absolute(x) \
254
+ ((likely(PyLong_CheckExact(x))) ? \
255
+ (likely(__Pyx_PyLong_IsNonNeg(x)) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) : \
256
+ PyNumber_Absolute(x))
257
+
258
+ #else
259
+ #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
260
+ #endif
261
+
262
+ //////////////////// py_abs ////////////////////
263
+
264
+ #if CYTHON_USE_PYLONG_INTERNALS
265
+ static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
266
+ #if PY_VERSION_HEX >= 0x030C00A7
267
+ if (likely(__Pyx_PyLong_IsCompact(n))) {
268
+ return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
269
+ }
270
+ #else
271
+ if (likely(Py_SIZE(n) == -1)) {
272
+ // digits are unsigned
273
+ return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
274
+ }
275
+ #endif
276
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
277
+ {
278
+ PyObject *copy = _PyLong_Copy((PyLongObject*)n);
279
+ if (likely(copy)) {
280
+ #if PY_VERSION_HEX >= 0x030C00A7
281
+ // clear the sign bits to set the sign from SIGN_NEGATIVE (2) to positive (0)
282
+ ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
283
+ #else
284
+ // negate the size to swap the sign
285
+ __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
286
+ #endif
287
+ }
288
+ return copy;
289
+ }
290
+ #else
291
+ return PyNumber_Negative(n);
292
+ #endif
293
+ }
294
+ #endif
295
+
296
+
297
+ //////////////////// pow2.proto ////////////////////
298
+
299
+ #define __Pyx_PyNumber_Power2(a, b) PyNumber_Power(a, b, Py_None)
300
+
301
+
302
+ //////////////////// divmod_int.proto //////////////////
303
+
304
+ static CYTHON_INLINE PyObject* __Pyx_divmod_int(int a, int b); /*proto*/
305
+
306
+
307
+ //////////////////// divmod_int //////////////////
308
+
309
+ static CYTHON_INLINE PyObject* __Pyx_divmod_int(int a, int b) {
310
+ PyObject *result_tuple = NULL, *pyvalue = NULL;
311
+ // Python and C/C++ use different algorithms in calculating quotients and remainders.
312
+ // This results in different answers between Python and C/C++
313
+ // when the dividend is negative and the divisor is positive and vice versa.
314
+ int q, r;
315
+ if ((a < 0 && b > 0) || (a > 0 && b < 0)) {
316
+ // see CMath.c :: DivInt and ModInt utility code
317
+ q = a / b;
318
+ r = a - q * b;
319
+ q -= ((r != 0) & ((r ^ b) < 0));
320
+ r += ((r != 0) & ((r ^ b) < 0)) * b;
321
+ }
322
+ else if (b == 0) {
323
+ PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
324
+ return NULL;
325
+ }
326
+ else {
327
+ div_t res = div(a, b);
328
+ q = res.quot;
329
+ r = res.rem;
330
+ }
331
+ result_tuple = PyTuple_New(2);
332
+ if (unlikely(!result_tuple)) return NULL;
333
+ pyvalue = PyLong_FromLong(q);
334
+ if (unlikely(!pyvalue)) goto bad;
335
+ if (__Pyx_PyTuple_SET_ITEM(result_tuple, 0, pyvalue) != (0)) goto bad;
336
+ pyvalue = PyLong_FromLong(r);
337
+ if (unlikely(!pyvalue)) goto bad;
338
+ if (__Pyx_PyTuple_SET_ITEM(result_tuple, 1, pyvalue) != (0)) goto bad;
339
+ return result_tuple;
340
+
341
+ bad:
342
+ Py_DECREF(result_tuple);
343
+ return NULL;
344
+ }
345
+
346
+
347
+ //////////////////// int_pyucs4.proto ////////////////////
348
+
349
+ static CYTHON_INLINE int __Pyx_int_from_UCS4(Py_UCS4 uchar);
350
+
351
+ //////////////////// int_pyucs4 ////////////////////
352
+
353
+ static int __Pyx_int_from_UCS4(Py_UCS4 uchar) {
354
+ int digit = Py_UNICODE_TODIGIT(uchar);
355
+ if (unlikely(digit < 0)) {
356
+ PyErr_Format(PyExc_ValueError,
357
+ "invalid literal for int() with base 10: '%c'",
358
+ (int) uchar);
359
+ return -1;
360
+ }
361
+ return digit;
362
+ }
363
+
364
+
365
+ //////////////////// float_pyucs4.proto ////////////////////
366
+
367
+ static CYTHON_INLINE double __Pyx_double_from_UCS4(Py_UCS4 uchar);
368
+
369
+ //////////////////// float_pyucs4 ////////////////////
370
+
371
+ static double __Pyx_double_from_UCS4(Py_UCS4 uchar) {
372
+ double digit = Py_UNICODE_TONUMERIC(uchar);
373
+ if (unlikely(digit < 0.0)) {
374
+ PyErr_Format(PyExc_ValueError,
375
+ "could not convert string to float: '%c'",
376
+ (int) uchar);
377
+ return -1.0;
378
+ }
379
+ return digit;
380
+ }
381
+
382
+
383
+ //////////////////// object_ord.proto ////////////////////
384
+ //@requires: TypeConversion.c::UnicodeAsUCS4
385
+
386
+ #define __Pyx_PyObject_Ord(c) \
387
+ (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c))
388
+ static long __Pyx__PyObject_Ord(PyObject* c); /*proto*/
389
+
390
+ //////////////////// object_ord ////////////////////
391
+
392
+ static long __Pyx__PyObject_Ord(PyObject* c) {
393
+ Py_ssize_t size;
394
+ if (PyBytes_Check(c)) {
395
+ size = __Pyx_PyBytes_GET_SIZE(c);
396
+ if (likely(size == 1)) {
397
+ #if CYTHON_ASSUME_SAFE_MACROS
398
+ return (unsigned char) PyBytes_AS_STRING(c)[0];
399
+ #else
400
+ char *data = PyBytes_AsString(c);
401
+ if (unlikely(!data)) return -1;
402
+ return (unsigned char) data[0];
403
+ #endif
404
+ }
405
+ #if !CYTHON_ASSUME_SAFE_SIZE
406
+ else if (unlikely(size < 0)) return -1;
407
+ #endif
408
+ } else if (PyByteArray_Check(c)) {
409
+ size = __Pyx_PyByteArray_GET_SIZE(c);
410
+ if (likely(size == 1)) {
411
+ #if CYTHON_ASSUME_SAFE_MACROS
412
+ return (unsigned char) PyByteArray_AS_STRING(c)[0];
413
+ #else
414
+ char *data = PyByteArray_AsString(c);
415
+ if (unlikely(!data)) return -1;
416
+ return (unsigned char) data[0];
417
+ #endif
418
+ }
419
+ #if !CYTHON_ASSUME_SAFE_SIZE
420
+ else if (unlikely(size < 0)) return -1;
421
+ #endif
422
+ } else {
423
+ // FIXME: support character buffers - but CPython doesn't support them either
424
+ __Pyx_TypeName c_type_name = __Pyx_PyType_GetName(Py_TYPE(c));
425
+ PyErr_Format(PyExc_TypeError,
426
+ "ord() expected string of length 1, but " __Pyx_FMT_TYPENAME " found",
427
+ c_type_name);
428
+ __Pyx_DECREF_TypeName(c_type_name);
429
+ return (long)(Py_UCS4)-1;
430
+ }
431
+ PyErr_Format(PyExc_TypeError,
432
+ "ord() expected a character, but string of length %zd found", size);
433
+ return (long)(Py_UCS4)-1;
434
+ }
435
+
436
+
437
+ //////////////////// py_dict_keys.proto ////////////////////
438
+
439
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); /*proto*/
440
+
441
+ //////////////////// py_dict_keys ////////////////////
442
+
443
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
444
+ return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
445
+ }
446
+
447
+ //////////////////// py_dict_values.proto ////////////////////
448
+
449
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /*proto*/
450
+
451
+ //////////////////// py_dict_values ////////////////////
452
+
453
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
454
+ return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
455
+ }
456
+
457
+ //////////////////// py_dict_items.proto ////////////////////
458
+
459
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/
460
+
461
+ //////////////////// py_dict_items ////////////////////
462
+
463
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
464
+ return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
465
+ }
466
+
467
+ //////////////////// py_dict_iterkeys.proto ////////////////////
468
+
469
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterKeys(PyObject* d); /*proto*/
470
+
471
+ //////////////////// py_dict_iterkeys ////////////////////
472
+
473
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterKeys(PyObject* d) {
474
+ return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
475
+ }
476
+
477
+ //////////////////// py_dict_itervalues.proto ////////////////////
478
+
479
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterValues(PyObject* d); /*proto*/
480
+
481
+ //////////////////// py_dict_itervalues ////////////////////
482
+
483
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterValues(PyObject* d) {
484
+ return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
485
+ }
486
+
487
+ //////////////////// py_dict_iteritems.proto ////////////////////
488
+
489
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterItems(PyObject* d); /*proto*/
490
+
491
+ //////////////////// py_dict_iteritems ////////////////////
492
+
493
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_IterItems(PyObject* d) {
494
+ return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
495
+ }
496
+
497
+ //////////////////// py_dict_viewkeys.proto ////////////////////
498
+
499
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewKeys(PyObject* d); /*proto*/
500
+
501
+ //////////////////// py_dict_viewkeys ////////////////////
502
+
503
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewKeys(PyObject* d) {
504
+ return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
505
+ }
506
+
507
+ //////////////////// py_dict_viewvalues.proto ////////////////////
508
+
509
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewValues(PyObject* d); /*proto*/
510
+
511
+ //////////////////// py_dict_viewvalues ////////////////////
512
+
513
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewValues(PyObject* d) {
514
+ return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
515
+ }
516
+
517
+ //////////////////// py_dict_viewitems.proto ////////////////////
518
+
519
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewItems(PyObject* d); /*proto*/
520
+
521
+ //////////////////// py_dict_viewitems ////////////////////
522
+
523
+ static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewItems(PyObject* d) {
524
+ return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
525
+ }
526
+
527
+
528
+ //////////////////// pyfrozenset_new.proto ////////////////////
529
+
530
+ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
531
+
532
+ //////////////////// pyfrozenset_new ////////////////////
533
+ //@requires: ObjectHandling.c::PyObjectCallNoArg
534
+
535
+ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
536
+ if (it) {
537
+ PyObject* result;
538
+ #if CYTHON_COMPILING_IN_PYPY
539
+ // PyPy currently lacks PyFrozenSet_CheckExact() and PyFrozenSet_New()
540
+ PyObject* args;
541
+ args = PyTuple_Pack(1, it);
542
+ if (unlikely(!args))
543
+ return NULL;
544
+ result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
545
+ Py_DECREF(args);
546
+ return result;
547
+ #else
548
+ if (PyFrozenSet_CheckExact(it)) {
549
+ Py_INCREF(it);
550
+ return it;
551
+ }
552
+ result = PyFrozenSet_New(it);
553
+ if (unlikely(!result))
554
+ return NULL;
555
+ if ((__PYX_LIMITED_VERSION_HEX >= 0x030A00A1)
556
+ #if CYTHON_COMPILING_IN_LIMITED_API
557
+ || __Pyx_get_runtime_version() >= 0x030A00A1
558
+ #endif
559
+ )
560
+ return result;
561
+ {
562
+ Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
563
+ if (likely(size > 0))
564
+ return result;
565
+ #if !CYTHON_ASSUME_SAFE_SIZE
566
+ if (unlikely(size < 0)) {
567
+ Py_DECREF(result);
568
+ return NULL;
569
+ }
570
+ #endif
571
+ }
572
+ // empty frozenset is a singleton (on Python <3.10)
573
+ // seems wasteful, but CPython does the same
574
+ Py_DECREF(result);
575
+ #endif
576
+ }
577
+ return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
578
+ }
579
+
580
+
581
+ //////////////////// PySet_Update.proto ////////////////////
582
+
583
+ static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it); /*proto*/
584
+
585
+ //////////////////// PySet_Update ////////////////////
586
+
587
+ static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it) {
588
+ PyObject *retval;
589
+ #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
590
+ if (PyAnySet_Check(it)) {
591
+ Py_ssize_t size = __Pyx_PySet_GET_SIZE(it);
592
+ #if !CYTHON_ASSUME_SAFE_SIZE
593
+ if (unlikely(size < 0)) return -1;
594
+ #endif
595
+ if (size == 0)
596
+ return 0;
597
+ // fast and safe case: CPython will update our result set and return it
598
+ retval = PySet_Type.tp_as_number->nb_inplace_or(set, it);
599
+ if (likely(retval == set)) {
600
+ Py_DECREF(retval);
601
+ return 0;
602
+ }
603
+ if (unlikely(!retval))
604
+ return -1;
605
+ // unusual result, fall through to set.update() call below
606
+ Py_DECREF(retval);
607
+ }
608
+ #endif
609
+ retval = CALL_UNBOUND_METHOD(PySet_Type, "update", set, it);
610
+ if (unlikely(!retval)) return -1;
611
+ Py_DECREF(retval);
612
+ return 0;
613
+ }
614
+
615
+ ///////////////// memoryview_get_from_buffer.proto ////////////////////
616
+
617
+ // buffer is in limited api from Py3.11
618
+ #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x030b0000
619
+ #define __Pyx_PyMemoryView_Get_{{name}}(o) PyMemoryView_GET_BUFFER(o)->{{name}}
620
+ #else
621
+ {{py:
622
+ out_types = dict(
623
+ ndim='int', readonly='int',
624
+ len='Py_ssize_t', itemsize='Py_ssize_t')
625
+ }} // can't get format like this unfortunately. It's unicode via getattr
626
+ {{py: out_type = out_types[name]}}
627
+ static {{out_type}} __Pyx_PyMemoryView_Get_{{name}}(PyObject *obj); /* proto */
628
+ #endif
629
+
630
+ ////////////// memoryview_get_from_buffer /////////////////////////
631
+
632
+ #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x030b0000
633
+ #else
634
+ {{py:
635
+ out_types = dict(
636
+ ndim='int', readonly='int',
637
+ len='Py_ssize_t', itemsize='Py_ssize_t')
638
+ }}
639
+ {{py: out_type = out_types[name]}}
640
+ static {{out_type}} __Pyx_PyMemoryView_Get_{{name}}(PyObject *obj) {
641
+ {{out_type}} result;
642
+ PyObject *attr = PyObject_GetAttr(obj, PYIDENT("{{name}}"));
643
+ if (!attr) {
644
+ goto bad;
645
+ }
646
+ {{if out_type == 'int'}}
647
+ // I'm not worrying about overflow here because
648
+ // ultimately it comes from a C struct that's an int
649
+ result = PyLong_AsLong(attr);
650
+ {{elif out_type == 'Py_ssize_t'}}
651
+ result = PyLong_AsSsize_t(attr);
652
+ {{endif}}
653
+ Py_DECREF(attr);
654
+ return result;
655
+
656
+ bad:
657
+ Py_XDECREF(attr);
658
+ return -1;
659
+ }
660
+ #endif