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,433 @@
1
+ from libc.stdio cimport FILE
2
+ cimport cpython.type
3
+
4
+ cdef extern from "Python.h":
5
+
6
+ ctypedef struct PyObject # forward declaration
7
+
8
+ ctypedef object (*newfunc)(cpython.type.type, PyObject*, PyObject*) # (type, args|NULL, kwargs|NULL)
9
+
10
+ ctypedef object (*unaryfunc)(object)
11
+ ctypedef object (*binaryfunc)(object, object)
12
+ ctypedef object (*ternaryfunc)(object, object, object)
13
+ ctypedef int (*inquiry)(object) except -1
14
+ ctypedef Py_ssize_t (*lenfunc)(object) except -1
15
+ ctypedef object (*ssizeargfunc)(object, Py_ssize_t)
16
+ ctypedef object (*ssizessizeargfunc)(object, Py_ssize_t, Py_ssize_t)
17
+ ctypedef int (*ssizeobjargproc)(object, Py_ssize_t, object) except -1
18
+ ctypedef int (*ssizessizeobjargproc)(object, Py_ssize_t, Py_ssize_t, object) except -1
19
+ ctypedef int (*objobjargproc)(object, object, object) except -1
20
+ ctypedef int (*objobjproc)(object, object) except -1
21
+
22
+ ctypedef Py_hash_t (*hashfunc)(object) except -1
23
+ ctypedef object (*reprfunc)(object)
24
+
25
+ ctypedef int (*cmpfunc)(object, object) except -2
26
+ ctypedef object (*richcmpfunc)(object, object, int)
27
+
28
+ # The following functions use 'PyObject*' as first argument instead of 'object' to prevent
29
+ # accidental reference counting when calling them during a garbage collection run.
30
+ ctypedef void (*destructor)(PyObject*)
31
+ ctypedef int (*visitproc)(PyObject*, void *) except -1
32
+ ctypedef int (*traverseproc)(PyObject*, visitproc, void*) except -1
33
+ ctypedef void (*freefunc)(void*)
34
+
35
+ ctypedef object (*descrgetfunc)(object, object, object)
36
+ ctypedef int (*descrsetfunc)(object, object, object) except -1
37
+
38
+ ctypedef object (*PyCFunction)(object, object)
39
+
40
+ ctypedef struct PyMethodDef:
41
+ const char* ml_name
42
+ PyCFunction ml_meth
43
+ int ml_flags
44
+ const char* ml_doc
45
+
46
+ ctypedef struct PyTypeObject:
47
+ const char* tp_name
48
+ const char* tp_doc
49
+ Py_ssize_t tp_basicsize
50
+ Py_ssize_t tp_itemsize
51
+ Py_ssize_t tp_dictoffset
52
+ unsigned long tp_flags
53
+
54
+ newfunc tp_new
55
+ destructor tp_dealloc
56
+ destructor tp_del
57
+ destructor tp_finalize
58
+ traverseproc tp_traverse
59
+ inquiry tp_clear
60
+ freefunc tp_free
61
+
62
+ ternaryfunc tp_call
63
+ hashfunc tp_hash
64
+ reprfunc tp_str
65
+ reprfunc tp_repr
66
+
67
+ cmpfunc tp_compare
68
+ richcmpfunc tp_richcompare
69
+
70
+ PyMethodDef* tp_methods
71
+
72
+ PyTypeObject* tp_base
73
+ PyObject* tp_dict
74
+
75
+ descrgetfunc tp_descr_get
76
+ descrsetfunc tp_descr_set
77
+
78
+ unsigned int tp_version_tag
79
+
80
+ ctypedef struct PyObject:
81
+ Py_ssize_t ob_refcnt
82
+ PyTypeObject *ob_type
83
+
84
+ cdef PyTypeObject *Py_TYPE(object)
85
+
86
+ void* PyObject_Malloc(size_t)
87
+ void* PyObject_Realloc(void *, size_t)
88
+ void PyObject_Free(void *)
89
+
90
+ #####################################################################
91
+ # 6.1 Object Protocol
92
+ #####################################################################
93
+ int PyObject_Print(object o, FILE *fp, int flags) except -1
94
+ # Print an object o, on file fp. Returns -1 on error. The flags
95
+ # argument is used to enable certain printing options. The only
96
+ # option currently supported is Py_PRINT_RAW; if given, the str()
97
+ # of the object is written instead of the repr().
98
+
99
+ bint PyObject_HasAttrString(object o, const char *attr_name)
100
+ # Returns 1 if o has the attribute attr_name, and 0
101
+ # otherwise. This is equivalent to the Python expression
102
+ # "hasattr(o, attr_name)". This function always succeeds.
103
+
104
+ object PyObject_GetAttrString(object o, const char *attr_name)
105
+ # Return value: New reference. Retrieve an attribute named
106
+ # attr_name from object o. Returns the attribute value on success,
107
+ # or NULL on failure. This is the equivalent of the Python
108
+ # expression "o.attr_name".
109
+
110
+ bint PyObject_HasAttr(object o, object attr_name)
111
+ # Returns 1 if o has the attribute attr_name, and 0
112
+ # otherwise. This is equivalent to the Python expression
113
+ # "hasattr(o, attr_name)". This function always succeeds.
114
+
115
+ object PyObject_GetAttr(object o, object attr_name)
116
+ # Return value: New reference. Retrieve an attribute named
117
+ # attr_name from object o. Returns the attribute value on success,
118
+ # or NULL on failure. This is the equivalent of the Python
119
+ # expression "o.attr_name".
120
+
121
+ object PyObject_GenericGetAttr(object o, object attr_name)
122
+
123
+ int PyObject_SetAttrString(object o, const char *attr_name, object v) except -1
124
+ # Set the value of the attribute named attr_name, for object o, to
125
+ # the value v. Returns -1 on failure. This is the equivalent of
126
+ # the Python statement "o.attr_name = v".
127
+
128
+ int PyObject_SetAttr(object o, object attr_name, object v) except -1
129
+ # Set the value of the attribute named attr_name, for object o, to
130
+ # the value v. Returns -1 on failure. This is the equivalent of
131
+ # the Python statement "o.attr_name = v".
132
+
133
+ int PyObject_GenericSetAttr(object o, object attr_name, object v) except -1
134
+
135
+ int PyObject_DelAttrString(object o, const char *attr_name) except -1
136
+ # Delete attribute named attr_name, for object o. Returns -1 on
137
+ # failure. This is the equivalent of the Python statement: "del
138
+ # o.attr_name".
139
+
140
+ int PyObject_DelAttr(object o, object attr_name) except -1
141
+ # Delete attribute named attr_name, for object o. Returns -1 on
142
+ # failure. This is the equivalent of the Python statement "del
143
+ # o.attr_name".
144
+
145
+ object PyObject_GenericGetDict(object o, void *context)
146
+ # Return value: New reference.
147
+ # A generic implementation for the getter of a __dict__ descriptor. It
148
+ # creates the dictionary if necessary.
149
+ # New in version 3.3.
150
+
151
+ int PyObject_GenericSetDict(object o, object value, void *context) except -1
152
+ # A generic implementation for the setter of a __dict__ descriptor. This
153
+ # implementation does not allow the dictionary to be deleted.
154
+ # New in version 3.3.
155
+
156
+ int Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
157
+
158
+ object PyObject_RichCompare(object o1, object o2, int opid)
159
+ # Return value: New reference.
160
+ # Compare the values of o1 and o2 using the operation specified by
161
+ # opid, which must be one of Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, or
162
+ # Py_GE, corresponding to <, <=, ==, !=, >, or >=
163
+ # respectively. This is the equivalent of the Python expression
164
+ # "o1 op o2", where op is the operator corresponding to
165
+ # opid. Returns the value of the comparison on success, or NULL on
166
+ # failure.
167
+
168
+ bint PyObject_RichCompareBool(object o1, object o2, int opid) except -1
169
+ # Compare the values of o1 and o2 using the operation specified by
170
+ # opid, which must be one of Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, or
171
+ # Py_GE, corresponding to <, <=, ==, !=, >, or >=
172
+ # respectively. Returns -1 on error, 0 if the result is false, 1
173
+ # otherwise. This is the equivalent of the Python expression "o1
174
+ # op o2", where op is the operator corresponding to opid.
175
+
176
+ int PyObject_Cmp(object o1, object o2, int *result) except -1
177
+ # Compare the values of o1 and o2 using a routine provided by o1,
178
+ # if one exists, otherwise with a routine provided by o2. The
179
+ # result of the comparison is returned in result. Returns -1 on
180
+ # failure. This is the equivalent of the Python statement "result
181
+ # = cmp(o1, o2)".
182
+
183
+ int PyObject_Compare(object o1, object o2) except *
184
+ # Compare the values of o1 and o2 using a routine provided by o1,
185
+ # if one exists, otherwise with a routine provided by o2. Returns
186
+ # the result of the comparison on success. On error, the value
187
+ # returned is undefined; use PyErr_Occurred() to detect an
188
+ # error. This is equivalent to the Python expression "cmp(o1,
189
+ # o2)".
190
+
191
+ object PyObject_Repr(object o)
192
+ # Return value: New reference.
193
+ # Compute a string representation of object o. Returns the string
194
+ # representation on success, NULL on failure. This is the
195
+ # equivalent of the Python expression "repr(o)". Called by the
196
+ # repr() built-in function and by reverse quotes.
197
+
198
+ object PyObject_Str(object o)
199
+ # Return value: New reference.
200
+ # Compute a string representation of object o. Returns the string
201
+ # representation on success, NULL on failure. This is the
202
+ # equivalent of the Python expression "str(o)". Called by the
203
+ # str() built-in function and by the print statement.
204
+
205
+ object PyObject_Bytes(object o)
206
+ # Return value: New reference.
207
+ # Compute a bytes representation of object o. Return NULL on
208
+ # failure and a bytes object on success. This is equivalent to
209
+ # the Python expression bytes(o), when o is not an integer.
210
+ # Unlike bytes(o), a TypeError is raised when o is an integer
211
+ # instead of a zero-initialized bytes object.
212
+
213
+ bint PyObject_IsInstance(object inst, object cls) except -1
214
+ # Returns 1 if inst is an instance of the class cls or a subclass
215
+ # of cls, or 0 if not. On error, returns -1 and sets an
216
+ # exception. If cls is a type object rather than a class object,
217
+ # PyObject_IsInstance() returns 1 if inst is of type cls. If cls
218
+ # is a tuple, the check will be done against every entry in
219
+ # cls. The result will be 1 when at least one of the checks
220
+ # returns 1, otherwise it will be 0. If inst is not a class
221
+ # instance and cls is neither a type object, nor a class object,
222
+ # nor a tuple, inst must have a __class__ attribute -- the class
223
+ # relationship of the value of that attribute with cls will be
224
+ # used to determine the result of this function.
225
+
226
+ # Subclass determination is done in a fairly straightforward way,
227
+ # but includes a wrinkle that implementors of extensions to the
228
+ # class system may want to be aware of. If A and B are class
229
+ # objects, B is a subclass of A if it inherits from A either
230
+ # directly or indirectly. If either is not a class object, a more
231
+ # general mechanism is used to determine the class relationship of
232
+ # the two objects. When testing if B is a subclass of A, if A is
233
+ # B, PyObject_IsSubclass() returns true. If A and B are different
234
+ # objects, B's __bases__ attribute is searched in a depth-first
235
+ # fashion for A -- the presence of the __bases__ attribute is
236
+ # considered sufficient for this determination.
237
+
238
+ bint PyObject_IsSubclass(object derived, object cls) except -1
239
+ # Returns 1 if the class derived is identical to or derived from
240
+ # the class cls, otherwise returns 0. In case of an error, returns
241
+ # -1. If cls is a tuple, the check will be done against every
242
+ # entry in cls. The result will be 1 when at least one of the
243
+ # checks returns 1, otherwise it will be 0. If either derived or
244
+ # cls is not an actual class object (or tuple), this function uses
245
+ # the generic algorithm described above. New in version
246
+ # 2.1. Changed in version 2.3: Older versions of Python did not
247
+ # support a tuple as the second argument.
248
+
249
+ bint PyCallable_Check(object o)
250
+ # Determine if the object o is callable. Return 1 if the object is
251
+ # callable and 0 otherwise. This function always succeeds.
252
+
253
+ object PyObject_Call(object callable_object, object args, object kw)
254
+ # Return value: New reference.
255
+ # Call a callable Python object callable_object, with arguments
256
+ # given by the tuple args, and named arguments given by the
257
+ # dictionary kw. If no named arguments are needed, kw may be
258
+ # NULL. args must not be NULL, use an empty tuple if no arguments
259
+ # are needed. Returns the result of the call on success, or NULL
260
+ # on failure. This is the equivalent of the Python expression
261
+ # "apply(callable_object, args, kw)" or "callable_object(*args,
262
+ # **kw)".
263
+
264
+ object PyObject_CallObject(object callable_object, object args)
265
+ # Return value: New reference.
266
+ # Call a callable Python object callable_object, with arguments
267
+ # given by the tuple args. If no arguments are needed, then args
268
+ # may be NULL. Returns the result of the call on success, or NULL
269
+ # on failure. This is the equivalent of the Python expression
270
+ # "apply(callable_object, args)" or "callable_object(*args)".
271
+
272
+ object PyObject_CallFunction(object callable, char *format, ...)
273
+ # Return value: New reference.
274
+ # Call a callable Python object callable, with a variable number
275
+ # of C arguments. The C arguments are described using a
276
+ # Py_BuildValue() style format string. The format may be NULL,
277
+ # indicating that no arguments are provided. Returns the result of
278
+ # the call on success, or NULL on failure. This is the equivalent
279
+ # of the Python expression "apply(callable, args)" or
280
+ # "callable(*args)". Note that if you only pass object args,
281
+ # PyObject_CallFunctionObjArgs is a faster alternative.
282
+
283
+ object PyObject_CallMethod(object o, char *method, char *format, ...)
284
+ # Return value: New reference.
285
+ # Call the method named method of object o with a variable number
286
+ # of C arguments. The C arguments are described by a
287
+ # Py_BuildValue() format string that should produce a tuple. The
288
+ # format may be NULL, indicating that no arguments are
289
+ # provided. Returns the result of the call on success, or NULL on
290
+ # failure. This is the equivalent of the Python expression
291
+ # "o.method(args)". Note that if you only pass object args,
292
+ # PyObject_CallMethodObjArgs is a faster alternative.
293
+
294
+ #object PyObject_CallFunctionObjArgs(object callable, ..., NULL)
295
+ object PyObject_CallFunctionObjArgs(object callable, ...)
296
+ # Return value: New reference.
297
+ # Call a callable Python object callable, with a variable number
298
+ # of PyObject* arguments. The arguments are provided as a variable
299
+ # number of parameters followed by NULL. Returns the result of the
300
+ # call on success, or NULL on failure.
301
+
302
+ #PyObject* PyObject_CallMethodObjArgs(object o, object name, ..., NULL)
303
+ object PyObject_CallMethodObjArgs(object o, object name, ...)
304
+ # Return value: New reference.
305
+ # Calls a method of the object o, where the name of the method is
306
+ # given as a Python string object in name. It is called with a
307
+ # variable number of PyObject* arguments. The arguments are
308
+ # provided as a variable number of parameters followed by
309
+ # NULL. Returns the result of the call on success, or NULL on
310
+ # failure.
311
+
312
+ long PyObject_Hash(object o) except? -1
313
+ # Compute and return the hash value of an object o. On failure,
314
+ # return -1. This is the equivalent of the Python expression
315
+ # "hash(o)".
316
+
317
+ bint PyObject_IsTrue(object o) except -1
318
+ # Returns 1 if the object o is considered to be true, and 0
319
+ # otherwise. This is equivalent to the Python expression "not not
320
+ # o". On failure, return -1.
321
+
322
+ bint PyObject_Not(object o) except -1
323
+ # Returns 0 if the object o is considered to be true, and 1
324
+ # otherwise. This is equivalent to the Python expression "not
325
+ # o". On failure, return -1.
326
+
327
+ object PyObject_Type(object o)
328
+ # Return value: New reference.
329
+ # When o is non-NULL, returns a type object corresponding to the
330
+ # object type of object o. On failure, raises SystemError and
331
+ # returns NULL. This is equivalent to the Python expression
332
+ # type(o). This function increments the reference count of the
333
+ # return value. There's really no reason to use this function
334
+ # instead of the common expression o->ob_type, which returns a
335
+ # pointer of type PyTypeObject*, except when the incremented
336
+ # reference count is needed.
337
+
338
+ bint PyObject_TypeCheck(object o, PyTypeObject *type)
339
+ # Return true if the object o is of type type or a subtype of
340
+ # type. Both parameters must be non-NULL.
341
+
342
+ Py_ssize_t PyObject_Length(object o) except -1
343
+ Py_ssize_t PyObject_Size(object o) except -1
344
+ # Return the length of object o. If the object o provides either
345
+ # the sequence and mapping protocols, the sequence length is
346
+ # returned. On error, -1 is returned. This is the equivalent to
347
+ # the Python expression "len(o)".
348
+
349
+ Py_ssize_t PyObject_LengthHint(object o, Py_ssize_t default) except -1
350
+ # Return an estimated length for the object o. First try to return its
351
+ # actual length, then an estimate using __length_hint__(), and finally
352
+ # return the default value. On error, return -1. This is the equivalent to
353
+ # the Python expression "operator.length_hint(o, default)".
354
+ # New in version 3.4.
355
+
356
+ object PyObject_GetItem(object o, object key)
357
+ # Return value: New reference.
358
+ # Return element of o corresponding to the object key or NULL on
359
+ # failure. This is the equivalent of the Python expression
360
+ # "o[key]".
361
+
362
+ int PyObject_SetItem(object o, object key, object v) except -1
363
+ # Map the object key to the value v. Returns -1 on failure. This
364
+ # is the equivalent of the Python statement "o[key] = v".
365
+
366
+ int PyObject_DelItem(object o, object key) except -1
367
+ # Delete the mapping for key from o. Returns -1 on failure. This
368
+ # is the equivalent of the Python statement "del o[key]".
369
+
370
+ int PyObject_AsFileDescriptor(object o) except -1
371
+ # Derives a file-descriptor from a Python object. If the object is
372
+ # an integer or long integer, its value is returned. If not, the
373
+ # object's fileno() method is called if it exists; the method must
374
+ # return an integer or long integer, which is returned as the file
375
+ # descriptor value. Returns -1 on failure.
376
+
377
+ object PyObject_Dir(object o)
378
+ # Return value: New reference.
379
+ # This is equivalent to the Python expression "dir(o)", returning
380
+ # a (possibly empty) list of strings appropriate for the object
381
+ # argument, or NULL if there was an error. If the argument is
382
+ # NULL, this is like the Python "dir()", returning the names of
383
+ # the current locals; in this case, if no execution frame is
384
+ # active then NULL is returned but PyErr_Occurred() will return
385
+ # false.
386
+
387
+ object PyObject_GetIter(object o)
388
+ # Return value: New reference.
389
+ # This is equivalent to the Python expression "iter(o)". It
390
+ # returns a new iterator for the object argument, or the object
391
+ # itself if the object is already an iterator. Raises TypeError
392
+ # and returns NULL if the object cannot be iterated.
393
+
394
+ Py_ssize_t Py_SIZE(object o)
395
+
396
+ object PyObject_Format(object obj, object format_spec)
397
+ # Takes an arbitrary object and returns the result of calling
398
+ # obj.__format__(format_spec).
399
+ # Added in Py2.6
400
+
401
+ # Type flags (tp_flags of PyTypeObject)
402
+ long Py_TPFLAGS_HAVE_GETCHARBUFFER
403
+ long Py_TPFLAGS_HAVE_SEQUENCE_IN
404
+ long Py_TPFLAGS_HAVE_INPLACEOPS
405
+ long Py_TPFLAGS_CHECKTYPES
406
+ long Py_TPFLAGS_HAVE_RICHCOMPARE
407
+ long Py_TPFLAGS_HAVE_WEAKREFS
408
+ long Py_TPFLAGS_HAVE_ITER
409
+ long Py_TPFLAGS_HAVE_CLASS
410
+ long Py_TPFLAGS_HEAPTYPE
411
+ long Py_TPFLAGS_BASETYPE
412
+ long Py_TPFLAGS_READY
413
+ long Py_TPFLAGS_READYING
414
+ long Py_TPFLAGS_HAVE_GC
415
+ long Py_TPFLAGS_HAVE_STACKLESS_EXTENSION
416
+ long Py_TPFLAGS_HAVE_INDEX
417
+ long Py_TPFLAGS_HAVE_VERSION_TAG
418
+ long Py_TPFLAGS_VALID_VERSION_TAG
419
+ long Py_TPFLAGS_IS_ABSTRACT
420
+ long Py_TPFLAGS_HAVE_NEWBUFFER
421
+ long Py_TPFLAGS_INT_SUBCLASS
422
+ long Py_TPFLAGS_LONG_SUBCLASS
423
+ long Py_TPFLAGS_LIST_SUBCLASS
424
+ long Py_TPFLAGS_TUPLE_SUBCLASS
425
+ long Py_TPFLAGS_STRING_SUBCLASS
426
+ long Py_TPFLAGS_UNICODE_SUBCLASS
427
+ long Py_TPFLAGS_DICT_SUBCLASS
428
+ long Py_TPFLAGS_BASE_EXC_SUBCLASS
429
+ long Py_TPFLAGS_TYPE_SUBCLASS
430
+ long Py_TPFLAGS_DEFAULT_EXTERNAL
431
+ long Py_TPFLAGS_DEFAULT_CORE
432
+ long Py_TPFLAGS_DEFAULT
433
+ long Py_TPFLAGS_HAVE_FINALIZE
@@ -0,0 +1,143 @@
1
+
2
+ # available since Python 2.7!
3
+
4
+
5
+ cdef extern from "Python.h":
6
+
7
+ ctypedef struct PyCapsule_Type
8
+ # This subtype of PyObject represents an opaque value, useful for
9
+ # C extension modules who need to pass an opaque value (as a void*
10
+ # pointer) through Python code to other C code. It is often used
11
+ # to make a C function pointer defined in one module available to
12
+ # other modules, so the regular import mechanism can be used to
13
+ # access C APIs defined in dynamically loaded modules.
14
+
15
+
16
+ ctypedef void (*PyCapsule_Destructor)(object o) noexcept
17
+ # The type of a destructor callback for a capsule.
18
+ #
19
+ # See PyCapsule_New() for the semantics of PyCapsule_Destructor
20
+ # callbacks.
21
+
22
+
23
+ bint PyCapsule_CheckExact(object o)
24
+ # Return true if its argument is a PyCapsule.
25
+
26
+
27
+ object PyCapsule_New(void *pointer, const char *name,
28
+ PyCapsule_Destructor destructor)
29
+ # Return value: New reference.
30
+ #
31
+ # Create a PyCapsule encapsulating the pointer. The pointer
32
+ # argument may not be NULL.
33
+ #
34
+ # On failure, set an exception and return NULL.
35
+ #
36
+ # The name string may either be NULL or a pointer to a valid C
37
+ # string. If non-NULL, this string must outlive the
38
+ # capsule. (Though it is permitted to free it inside the
39
+ # destructor.)
40
+ #
41
+ # If the destructor argument is not NULL, it will be called with
42
+ # the capsule as its argument when it is destroyed.
43
+ #
44
+ # If this capsule will be stored as an attribute of a module, the
45
+ # name should be specified as modulename.attributename. This will
46
+ # enable other modules to import the capsule using
47
+ # PyCapsule_Import().
48
+
49
+
50
+ void* PyCapsule_GetPointer(object capsule, const char *name) except? NULL
51
+ # Retrieve the pointer stored in the capsule. On failure, set an
52
+ # exception and return NULL.
53
+ #
54
+ # The name parameter must compare exactly to the name stored in
55
+ # the capsule. If the name stored in the capsule is NULL, the name
56
+ # passed in must also be NULL. Python uses the C function strcmp()
57
+ # to compare capsule names.
58
+
59
+
60
+ PyCapsule_Destructor PyCapsule_GetDestructor(object capsule) except? NULL
61
+ # Return the current destructor stored in the capsule. On failure,
62
+ # set an exception and return NULL.
63
+ #
64
+ # It is legal for a capsule to have a NULL destructor. This makes
65
+ # a NULL return code somewhat ambiguous; use PyCapsule_IsValid()
66
+ # or PyErr_Occurred() to disambiguate.
67
+
68
+
69
+ const char* PyCapsule_GetName(object capsule) except? NULL
70
+ # Return the current name stored in the capsule. On failure, set
71
+ # an exception and return NULL.
72
+ #
73
+ # It is legal for a capsule to have a NULL name. This makes a NULL
74
+ # return code somewhat ambiguous; use PyCapsule_IsValid() or
75
+ # PyErr_Occurred() to disambiguate.
76
+
77
+
78
+ void* PyCapsule_GetContext(object capsule) except? NULL
79
+ # Return the current context stored in the capsule. On failure,
80
+ # set an exception and return NULL.
81
+ #
82
+ # It is legal for a capsule to have a NULL context. This makes a
83
+ # NULL return code somewhat ambiguous; use PyCapsule_IsValid() or
84
+ # PyErr_Occurred() to disambiguate.
85
+
86
+
87
+ bint PyCapsule_IsValid(object capsule, const char *name)
88
+ # Determines whether or not capsule is a valid capsule. A valid
89
+ # capsule is non-NULL, passes PyCapsule_CheckExact(), has a
90
+ # non-NULL pointer stored in it, and its internal name matches the
91
+ # name parameter. (See PyCapsule_GetPointer() for information on
92
+ # how capsule names are compared.)
93
+ #
94
+ # In other words, if PyCapsule_IsValid() returns a true value,
95
+ # calls to any of the accessors (any function starting with
96
+ # PyCapsule_Get()) are guaranteed to succeed.
97
+ #
98
+ # Return a nonzero value if the object is valid and matches the
99
+ # name passed in. Return 0 otherwise. This function will not fail.
100
+
101
+
102
+ int PyCapsule_SetPointer(object capsule, void *pointer) except -1
103
+ # Set the void pointer inside capsule to pointer. The pointer may
104
+ # not be NULL.
105
+ #
106
+ # Return 0 on success. Return nonzero and set an exception on
107
+ # failure.
108
+
109
+
110
+ int PyCapsule_SetDestructor(object capsule, PyCapsule_Destructor destructor) except -1
111
+ # Set the destructor inside capsule to destructor.
112
+ #
113
+ # Return 0 on success. Return nonzero and set an exception on
114
+ # failure.
115
+
116
+
117
+ int PyCapsule_SetName(object capsule, const char *name) except -1
118
+ # Set the name inside capsule to name. If non-NULL, the name must
119
+ # outlive the capsule. If the previous name stored in the capsule
120
+ # was not NULL, no attempt is made to free it.
121
+ #
122
+ # Return 0 on success. Return nonzero and set an exception on
123
+ # failure.
124
+
125
+
126
+ int PyCapsule_SetContext(object capsule, void *context) except -1
127
+ # Set the context pointer inside capsule to context. Return 0 on
128
+ # success. Return nonzero and set an exception on failure.
129
+
130
+
131
+ void* PyCapsule_Import(const char *name, int no_block) except? NULL
132
+ # Import a pointer to a C object from a capsule attribute in a
133
+ # module. The name parameter should specify the full name to the
134
+ # attribute, as in module.attribute. The name stored in the
135
+ # capsule must match this string exactly. If no_block is true,
136
+ # import the module without blocking (using
137
+ # PyImport_ImportModuleNoBlock()). If no_block is false, import
138
+ # the module conventionally (using PyImport_ImportModule()).
139
+ #
140
+ # Return the capsule’s internal pointer on success. On failure,
141
+ # set an exception and return NULL. However, if PyCapsule_Import()
142
+ # failed to import the module, and no_block was true, no exception
143
+ # is set.
@@ -0,0 +1,68 @@
1
+ # Interfaces to configure, query, create & destroy the Python runtime
2
+
3
+ from libc.stdio cimport FILE
4
+ from .pystate cimport PyThreadState
5
+
6
+
7
+ cdef extern from "Python.h":
8
+ ctypedef int wchar_t
9
+
10
+ void Py_SetProgramName(wchar_t *)
11
+ wchar_t *Py_GetProgramName()
12
+
13
+ void Py_SetPythonHome(wchar_t *)
14
+ wchar_t *Py_GetPythonHome()
15
+
16
+ # Only used by applications that embed the interpreter and need to
17
+ # override the standard encoding determination mechanism
18
+ int Py_SetStandardStreamEncoding(const char *encoding, const char *errors)
19
+
20
+ void Py_Initialize()
21
+ void Py_InitializeEx(int)
22
+ void _Py_InitializeEx_Private(int, int)
23
+ void Py_Finalize()
24
+ int Py_FinalizeEx()
25
+ int Py_IsInitialized()
26
+ PyThreadState *Py_NewInterpreter()
27
+ void Py_EndInterpreter(PyThreadState *)
28
+
29
+
30
+ # _Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
31
+ # exit functions.
32
+ void _Py_PyAtExit(void (*func)(object), object)
33
+ int Py_AtExit(void (*func)())
34
+
35
+ void Py_Exit(int)
36
+
37
+ # Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
38
+ void _Py_RestoreSignals()
39
+
40
+ int Py_FdIsInteractive(FILE *, const char *)
41
+
42
+ # Bootstrap __main__ (defined in Modules/main.c)
43
+ int Py_Main(int argc, wchar_t **argv)
44
+
45
+ # In getpath.c
46
+ wchar_t *Py_GetProgramFullPath()
47
+ wchar_t *Py_GetPrefix()
48
+ wchar_t *Py_GetExecPrefix()
49
+ wchar_t *Py_GetPath()
50
+ void Py_SetPath(const wchar_t *)
51
+ int _Py_CheckPython3()
52
+
53
+ # In their own files
54
+ const char *Py_GetVersion()
55
+ const char *Py_GetPlatform()
56
+ const char *Py_GetCopyright()
57
+ const char *Py_GetCompiler()
58
+ const char *Py_GetBuildInfo()
59
+ const char *_Py_gitidentifier()
60
+ const char *_Py_gitversion()
61
+
62
+ ctypedef void (*PyOS_sighandler_t)(int)
63
+ PyOS_sighandler_t PyOS_getsig(int)
64
+ PyOS_sighandler_t PyOS_setsig(int, PyOS_sighandler_t)
65
+
66
+ # Random
67
+ int _PyOS_URandom(void *buffer, Py_ssize_t size)
68
+ int _PyOS_URandomNonblock(void *buffer, Py_ssize_t size)
@@ -0,0 +1,8 @@
1
+ cdef extern from "Python.h":
2
+ ctypedef int int32_t
3
+ ctypedef int int64_t
4
+ ctypedef unsigned int uint32_t
5
+ ctypedef unsigned int uint64_t
6
+
7
+ const Py_ssize_t PY_SSIZE_T_MIN
8
+ const Py_ssize_t PY_SSIZE_T_MAX