Cython 3.2.0__cp39-abi3-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. Cython/Build/BuildExecutable.py +169 -0
  2. Cython/Build/Cache.py +199 -0
  3. Cython/Build/Cythonize.py +350 -0
  4. Cython/Build/Dependencies.py +1314 -0
  5. Cython/Build/Distutils.py +1 -0
  6. Cython/Build/Inline.py +463 -0
  7. Cython/Build/IpythonMagic.py +560 -0
  8. Cython/Build/SharedModule.py +94 -0
  9. Cython/Build/Tests/TestCyCache.py +194 -0
  10. Cython/Build/Tests/TestCythonizeArgsParser.py +481 -0
  11. Cython/Build/Tests/TestDependencies.py +133 -0
  12. Cython/Build/Tests/TestInline.py +177 -0
  13. Cython/Build/Tests/TestIpythonMagic.py +287 -0
  14. Cython/Build/Tests/TestRecythonize.py +212 -0
  15. Cython/Build/Tests/TestStripLiterals.py +155 -0
  16. Cython/Build/Tests/__init__.py +1 -0
  17. Cython/Build/__init__.py +11 -0
  18. Cython/CodeWriter.py +815 -0
  19. Cython/Compiler/AnalysedTreeTransforms.py +97 -0
  20. Cython/Compiler/Annotate.py +328 -0
  21. Cython/Compiler/AutoDocTransforms.py +320 -0
  22. Cython/Compiler/Buffer.py +680 -0
  23. Cython/Compiler/Builtin.py +984 -0
  24. Cython/Compiler/CmdLine.py +263 -0
  25. Cython/Compiler/Code.pxd +149 -0
  26. Cython/Compiler/Code.py +3746 -0
  27. Cython/Compiler/Code.pyd +0 -0
  28. Cython/Compiler/CodeGeneration.py +33 -0
  29. Cython/Compiler/CythonScope.py +191 -0
  30. Cython/Compiler/Dataclass.py +864 -0
  31. Cython/Compiler/DebugFlags.py +24 -0
  32. Cython/Compiler/Errors.py +297 -0
  33. Cython/Compiler/ExprNodes.py +15562 -0
  34. Cython/Compiler/FlowControl.pxd +97 -0
  35. Cython/Compiler/FlowControl.py +1451 -0
  36. Cython/Compiler/FlowControl.pyd +0 -0
  37. Cython/Compiler/FusedNode.py +971 -0
  38. Cython/Compiler/FusedNode.pyd +0 -0
  39. Cython/Compiler/Future.py +16 -0
  40. Cython/Compiler/Interpreter.py +57 -0
  41. Cython/Compiler/Lexicon.py +421 -0
  42. Cython/Compiler/LineTable.py +114 -0
  43. Cython/Compiler/LineTable.pyd +0 -0
  44. Cython/Compiler/Main.py +857 -0
  45. Cython/Compiler/MatchCaseNodes.py +259 -0
  46. Cython/Compiler/MemoryView.py +905 -0
  47. Cython/Compiler/ModuleNode.py +4235 -0
  48. Cython/Compiler/Naming.py +363 -0
  49. Cython/Compiler/Nodes.py +10831 -0
  50. Cython/Compiler/Optimize.py +5288 -0
  51. Cython/Compiler/Options.py +843 -0
  52. Cython/Compiler/ParseTreeTransforms.pxd +78 -0
  53. Cython/Compiler/ParseTreeTransforms.py +4638 -0
  54. Cython/Compiler/Parsing.pxd +9 -0
  55. Cython/Compiler/Parsing.py +4775 -0
  56. Cython/Compiler/Parsing.pyd +0 -0
  57. Cython/Compiler/Pipeline.py +439 -0
  58. Cython/Compiler/PyrexTypes.py +5870 -0
  59. Cython/Compiler/Pythran.py +232 -0
  60. Cython/Compiler/Scanning.pxd +48 -0
  61. Cython/Compiler/Scanning.py +701 -0
  62. Cython/Compiler/Scanning.pyd +0 -0
  63. Cython/Compiler/StringEncoding.py +298 -0
  64. Cython/Compiler/Symtab.py +3073 -0
  65. Cython/Compiler/Tests/TestBuffer.py +105 -0
  66. Cython/Compiler/Tests/TestBuiltin.py +72 -0
  67. Cython/Compiler/Tests/TestCmdLine.py +586 -0
  68. Cython/Compiler/Tests/TestCode.py +144 -0
  69. Cython/Compiler/Tests/TestFlowControl.py +65 -0
  70. Cython/Compiler/Tests/TestGrammar.py +202 -0
  71. Cython/Compiler/Tests/TestMemView.py +71 -0
  72. Cython/Compiler/Tests/TestParseTreeTransforms.py +285 -0
  73. Cython/Compiler/Tests/TestScanning.py +134 -0
  74. Cython/Compiler/Tests/TestSignatureMatching.py +73 -0
  75. Cython/Compiler/Tests/TestStringEncoding.py +21 -0
  76. Cython/Compiler/Tests/TestTreeFragment.py +63 -0
  77. Cython/Compiler/Tests/TestTreePath.py +103 -0
  78. Cython/Compiler/Tests/TestTypes.py +75 -0
  79. Cython/Compiler/Tests/TestUtilityLoad.py +112 -0
  80. Cython/Compiler/Tests/TestVisitor.py +61 -0
  81. Cython/Compiler/Tests/Utils.py +36 -0
  82. Cython/Compiler/Tests/__init__.py +1 -0
  83. Cython/Compiler/TreeFragment.py +278 -0
  84. Cython/Compiler/TreePath.py +303 -0
  85. Cython/Compiler/TypeInference.py +591 -0
  86. Cython/Compiler/TypeSlots.py +1174 -0
  87. Cython/Compiler/UFuncs.py +311 -0
  88. Cython/Compiler/UtilNodes.py +389 -0
  89. Cython/Compiler/UtilityCode.py +344 -0
  90. Cython/Compiler/Version.py +8 -0
  91. Cython/Compiler/Visitor.pxd +53 -0
  92. Cython/Compiler/Visitor.py +861 -0
  93. Cython/Compiler/Visitor.pyd +0 -0
  94. Cython/Compiler/__init__.py +1 -0
  95. Cython/Coverage.py +448 -0
  96. Cython/Debugger/Cygdb.py +177 -0
  97. Cython/Debugger/DebugWriter.py +82 -0
  98. Cython/Debugger/Tests/TestLibCython.py +275 -0
  99. Cython/Debugger/Tests/__init__.py +1 -0
  100. Cython/Debugger/Tests/cfuncs.c +8 -0
  101. Cython/Debugger/Tests/codefile +49 -0
  102. Cython/Debugger/Tests/test_libcython_in_gdb.py +578 -0
  103. Cython/Debugger/Tests/test_libpython_in_gdb.py +90 -0
  104. Cython/Debugger/__init__.py +1 -0
  105. Cython/Debugger/libcython.py +1548 -0
  106. Cython/Debugger/libpython.py +2821 -0
  107. Cython/Debugging.py +20 -0
  108. Cython/Distutils/__init__.py +2 -0
  109. Cython/Distutils/build_ext.py +139 -0
  110. Cython/Distutils/extension.py +96 -0
  111. Cython/Distutils/old_build_ext.py +351 -0
  112. Cython/Includes/cpython/__init__.pxd +173 -0
  113. Cython/Includes/cpython/array.pxd +178 -0
  114. Cython/Includes/cpython/bool.pxd +37 -0
  115. Cython/Includes/cpython/buffer.pxd +112 -0
  116. Cython/Includes/cpython/bytearray.pxd +33 -0
  117. Cython/Includes/cpython/bytes.pxd +200 -0
  118. Cython/Includes/cpython/cellobject.pxd +35 -0
  119. Cython/Includes/cpython/ceval.pxd +8 -0
  120. Cython/Includes/cpython/codecs.pxd +121 -0
  121. Cython/Includes/cpython/complex.pxd +60 -0
  122. Cython/Includes/cpython/contextvars.pxd +145 -0
  123. Cython/Includes/cpython/conversion.pxd +36 -0
  124. Cython/Includes/cpython/datetime.pxd +395 -0
  125. Cython/Includes/cpython/descr.pxd +26 -0
  126. Cython/Includes/cpython/dict.pxd +187 -0
  127. Cython/Includes/cpython/exc.pxd +263 -0
  128. Cython/Includes/cpython/fileobject.pxd +57 -0
  129. Cython/Includes/cpython/float.pxd +47 -0
  130. Cython/Includes/cpython/function.pxd +65 -0
  131. Cython/Includes/cpython/genobject.pxd +25 -0
  132. Cython/Includes/cpython/getargs.pxd +12 -0
  133. Cython/Includes/cpython/instance.pxd +25 -0
  134. Cython/Includes/cpython/iterator.pxd +36 -0
  135. Cython/Includes/cpython/iterobject.pxd +24 -0
  136. Cython/Includes/cpython/list.pxd +92 -0
  137. Cython/Includes/cpython/long.pxd +149 -0
  138. Cython/Includes/cpython/longintrepr.pxd +14 -0
  139. Cython/Includes/cpython/mapping.pxd +63 -0
  140. Cython/Includes/cpython/marshal.pxd +66 -0
  141. Cython/Includes/cpython/mem.pxd +120 -0
  142. Cython/Includes/cpython/memoryview.pxd +50 -0
  143. Cython/Includes/cpython/method.pxd +49 -0
  144. Cython/Includes/cpython/module.pxd +208 -0
  145. Cython/Includes/cpython/number.pxd +258 -0
  146. Cython/Includes/cpython/object.pxd +433 -0
  147. Cython/Includes/cpython/pycapsule.pxd +143 -0
  148. Cython/Includes/cpython/pylifecycle.pxd +68 -0
  149. Cython/Includes/cpython/pyport.pxd +8 -0
  150. Cython/Includes/cpython/pystate.pxd +95 -0
  151. Cython/Includes/cpython/pythread.pxd +53 -0
  152. Cython/Includes/cpython/ref.pxd +141 -0
  153. Cython/Includes/cpython/sequence.pxd +134 -0
  154. Cython/Includes/cpython/set.pxd +119 -0
  155. Cython/Includes/cpython/slice.pxd +70 -0
  156. Cython/Includes/cpython/time.pxd +129 -0
  157. Cython/Includes/cpython/tuple.pxd +72 -0
  158. Cython/Includes/cpython/type.pxd +53 -0
  159. Cython/Includes/cpython/unicode.pxd +639 -0
  160. Cython/Includes/cpython/version.pxd +32 -0
  161. Cython/Includes/cpython/weakref.pxd +78 -0
  162. Cython/Includes/libc/__init__.pxd +1 -0
  163. Cython/Includes/libc/complex.pxd +35 -0
  164. Cython/Includes/libc/errno.pxd +127 -0
  165. Cython/Includes/libc/float.pxd +43 -0
  166. Cython/Includes/libc/limits.pxd +28 -0
  167. Cython/Includes/libc/locale.pxd +46 -0
  168. Cython/Includes/libc/math.pxd +209 -0
  169. Cython/Includes/libc/setjmp.pxd +10 -0
  170. Cython/Includes/libc/signal.pxd +64 -0
  171. Cython/Includes/libc/stddef.pxd +9 -0
  172. Cython/Includes/libc/stdint.pxd +105 -0
  173. Cython/Includes/libc/stdio.pxd +80 -0
  174. Cython/Includes/libc/stdlib.pxd +72 -0
  175. Cython/Includes/libc/string.pxd +50 -0
  176. Cython/Includes/libc/threads.pxd +234 -0
  177. Cython/Includes/libc/time.pxd +52 -0
  178. Cython/Includes/libcpp/__init__.pxd +4 -0
  179. Cython/Includes/libcpp/algorithm.pxd +320 -0
  180. Cython/Includes/libcpp/any.pxd +16 -0
  181. Cython/Includes/libcpp/atomic.pxd +59 -0
  182. Cython/Includes/libcpp/barrier.pxd +22 -0
  183. Cython/Includes/libcpp/bit.pxd +29 -0
  184. Cython/Includes/libcpp/cast.pxd +12 -0
  185. Cython/Includes/libcpp/cmath.pxd +518 -0
  186. Cython/Includes/libcpp/complex.pxd +106 -0
  187. Cython/Includes/libcpp/condition_variable.pxd +322 -0
  188. Cython/Includes/libcpp/deque.pxd +165 -0
  189. Cython/Includes/libcpp/exception.pxd +86 -0
  190. Cython/Includes/libcpp/execution.pxd +15 -0
  191. Cython/Includes/libcpp/forward_list.pxd +63 -0
  192. Cython/Includes/libcpp/functional.pxd +26 -0
  193. Cython/Includes/libcpp/future.pxd +103 -0
  194. Cython/Includes/libcpp/iterator.pxd +34 -0
  195. Cython/Includes/libcpp/latch.pxd +17 -0
  196. Cython/Includes/libcpp/limits.pxd +61 -0
  197. Cython/Includes/libcpp/list.pxd +117 -0
  198. Cython/Includes/libcpp/map.pxd +252 -0
  199. Cython/Includes/libcpp/memory.pxd +115 -0
  200. Cython/Includes/libcpp/mutex.pxd +387 -0
  201. Cython/Includes/libcpp/numbers.pxd +15 -0
  202. Cython/Includes/libcpp/numeric.pxd +131 -0
  203. Cython/Includes/libcpp/optional.pxd +34 -0
  204. Cython/Includes/libcpp/pair.pxd +1 -0
  205. Cython/Includes/libcpp/queue.pxd +25 -0
  206. Cython/Includes/libcpp/random.pxd +166 -0
  207. Cython/Includes/libcpp/semaphore.pxd +43 -0
  208. Cython/Includes/libcpp/set.pxd +228 -0
  209. Cython/Includes/libcpp/shared_mutex.pxd +96 -0
  210. Cython/Includes/libcpp/span.pxd +87 -0
  211. Cython/Includes/libcpp/stack.pxd +11 -0
  212. Cython/Includes/libcpp/stop_token.pxd +117 -0
  213. Cython/Includes/libcpp/string.pxd +355 -0
  214. Cython/Includes/libcpp/string_view.pxd +183 -0
  215. Cython/Includes/libcpp/typeindex.pxd +15 -0
  216. Cython/Includes/libcpp/typeinfo.pxd +10 -0
  217. Cython/Includes/libcpp/unordered_map.pxd +193 -0
  218. Cython/Includes/libcpp/unordered_set.pxd +152 -0
  219. Cython/Includes/libcpp/utility.pxd +30 -0
  220. Cython/Includes/libcpp/vector.pxd +186 -0
  221. Cython/Includes/numpy/math.pxd +150 -0
  222. Cython/Includes/openmp.pxd +50 -0
  223. Cython/Includes/posix/__init__.pxd +1 -0
  224. Cython/Includes/posix/dlfcn.pxd +14 -0
  225. Cython/Includes/posix/fcntl.pxd +86 -0
  226. Cython/Includes/posix/ioctl.pxd +4 -0
  227. Cython/Includes/posix/mman.pxd +101 -0
  228. Cython/Includes/posix/resource.pxd +57 -0
  229. Cython/Includes/posix/select.pxd +21 -0
  230. Cython/Includes/posix/signal.pxd +73 -0
  231. Cython/Includes/posix/stat.pxd +98 -0
  232. Cython/Includes/posix/stdio.pxd +37 -0
  233. Cython/Includes/posix/stdlib.pxd +29 -0
  234. Cython/Includes/posix/strings.pxd +9 -0
  235. Cython/Includes/posix/time.pxd +71 -0
  236. Cython/Includes/posix/types.pxd +30 -0
  237. Cython/Includes/posix/uio.pxd +26 -0
  238. Cython/Includes/posix/unistd.pxd +271 -0
  239. Cython/Includes/posix/wait.pxd +38 -0
  240. Cython/Plex/Actions.pxd +24 -0
  241. Cython/Plex/Actions.py +119 -0
  242. Cython/Plex/Actions.pyd +0 -0
  243. Cython/Plex/DFA.pxd +14 -0
  244. Cython/Plex/DFA.py +164 -0
  245. Cython/Plex/DFA.pyd +0 -0
  246. Cython/Plex/Errors.py +48 -0
  247. Cython/Plex/Lexicons.py +178 -0
  248. Cython/Plex/Machines.pxd +36 -0
  249. Cython/Plex/Machines.py +238 -0
  250. Cython/Plex/Machines.pyd +0 -0
  251. Cython/Plex/Regexps.py +535 -0
  252. Cython/Plex/Scanners.pxd +45 -0
  253. Cython/Plex/Scanners.py +328 -0
  254. Cython/Plex/Scanners.pyd +0 -0
  255. Cython/Plex/Transitions.pxd +14 -0
  256. Cython/Plex/Transitions.py +239 -0
  257. Cython/Plex/Transitions.pyd +0 -0
  258. Cython/Plex/__init__.py +34 -0
  259. Cython/Runtime/__init__.py +1 -0
  260. Cython/Runtime/refnanny.pyd +0 -0
  261. Cython/Runtime/refnanny.pyx +237 -0
  262. Cython/Shadow.py +690 -0
  263. Cython/Shadow.pyi +521 -0
  264. Cython/StringIOTree.py +170 -0
  265. Cython/StringIOTree.pyd +0 -0
  266. Cython/Tempita/__init__.py +4 -0
  267. Cython/Tempita/_looper.py +154 -0
  268. Cython/Tempita/_tempita.py +1091 -0
  269. Cython/Tempita/_tempita.pyd +0 -0
  270. Cython/TestUtils.py +422 -0
  271. Cython/Tests/TestCodeWriter.py +128 -0
  272. Cython/Tests/TestCythonUtils.py +202 -0
  273. Cython/Tests/TestJediTyper.py +223 -0
  274. Cython/Tests/TestShadow.py +114 -0
  275. Cython/Tests/TestStringIOTree.py +67 -0
  276. Cython/Tests/TestTestUtils.py +90 -0
  277. Cython/Tests/__init__.py +1 -0
  278. Cython/Tests/xmlrunner.py +390 -0
  279. Cython/Utility/AsyncGen.c +1031 -0
  280. Cython/Utility/Buffer.c +865 -0
  281. Cython/Utility/BufferFormatFromTypeInfo.pxd +2 -0
  282. Cython/Utility/Builtins.c +810 -0
  283. Cython/Utility/CConvert.pyx +134 -0
  284. Cython/Utility/CMath.c +104 -0
  285. Cython/Utility/CommonStructures.c +226 -0
  286. Cython/Utility/Complex.c +378 -0
  287. Cython/Utility/Coroutine.c +2300 -0
  288. Cython/Utility/CpdefEnums.pyx +103 -0
  289. Cython/Utility/CppConvert.pyx +282 -0
  290. Cython/Utility/CppSupport.cpp +151 -0
  291. Cython/Utility/CythonFunction.c +1832 -0
  292. Cython/Utility/Dataclasses.c +101 -0
  293. Cython/Utility/Embed.c +121 -0
  294. Cython/Utility/Exceptions.c +1016 -0
  295. Cython/Utility/ExtensionTypes.c +996 -0
  296. Cython/Utility/FunctionArguments.c +1043 -0
  297. Cython/Utility/FusedFunction.pyx +44 -0
  298. Cython/Utility/ImportExport.c +907 -0
  299. Cython/Utility/MemoryView.pxd +188 -0
  300. Cython/Utility/MemoryView.pyx +1482 -0
  301. Cython/Utility/MemoryView_C.c +927 -0
  302. Cython/Utility/ModuleSetupCode.c +3203 -0
  303. Cython/Utility/NumpyImportArray.c +46 -0
  304. Cython/Utility/ObjectHandling.c +3273 -0
  305. Cython/Utility/Optimize.c +1603 -0
  306. Cython/Utility/Overflow.c +384 -0
  307. Cython/Utility/Printing.c +86 -0
  308. Cython/Utility/Profile.c +732 -0
  309. Cython/Utility/StringTools.c +1379 -0
  310. Cython/Utility/Synchronization.c +399 -0
  311. Cython/Utility/TString.c +356 -0
  312. Cython/Utility/TestCyUtilityLoader.pyx +8 -0
  313. Cython/Utility/TestCythonScope.pyx +75 -0
  314. Cython/Utility/TestUtilityLoader.c +12 -0
  315. Cython/Utility/TypeConversion.c +1385 -0
  316. Cython/Utility/UFuncs.pyx +50 -0
  317. Cython/Utility/UFuncs_C.c +89 -0
  318. Cython/Utility/__init__.py +28 -0
  319. Cython/Utility/arrayarray.h +167 -0
  320. Cython/Utils.py +687 -0
  321. Cython/Utils.pyd +0 -0
  322. Cython/__init__.py +10 -0
  323. Cython/__init__.pyi +7 -0
  324. Cython/py.typed +0 -0
  325. cython-3.2.0.dist-info/METADATA +85 -0
  326. cython-3.2.0.dist-info/RECORD +333 -0
  327. cython-3.2.0.dist-info/WHEEL +5 -0
  328. cython-3.2.0.dist-info/entry_points.txt +4 -0
  329. cython-3.2.0.dist-info/top_level.txt +3 -0
  330. cython.py +29 -0
  331. pyximport/__init__.py +4 -0
  332. pyximport/pyxbuild.py +160 -0
  333. pyximport/pyximport.py +482 -0
@@ -0,0 +1,639 @@
1
+ from libc.stddef cimport wchar_t
2
+
3
+ cdef extern from *:
4
+ ctypedef unsigned char Py_UCS1 # uint8_t
5
+ ctypedef unsigned short Py_UCS2 # uint16_t
6
+
7
+ # Return true if the object o is a Unicode object or an instance
8
+ # of a Unicode subtype. Changed in version 2.2: Allowed subtypes
9
+ # to be accepted.
10
+ bint PyUnicode_Check(object o)
11
+
12
+ # Return true if the object o is a Unicode object, but not an
13
+ # instance of a subtype. New in version 2.2.
14
+ bint PyUnicode_CheckExact(object o)
15
+
16
+ # Return the size of the object. o has to be a PyUnicodeObject
17
+ # (not checked).
18
+ #
19
+ # Deprecated since version 3.3, will be removed in version 3.10:
20
+ # Part of the old-style Unicode API, please migrate to using
21
+ # PyUnicode_GET_LENGTH().
22
+ Py_ssize_t PyUnicode_GET_SIZE(object o)
23
+
24
+ # Return the length of the Unicode string, in code points. o has
25
+ # to be a Unicode object in the “canonical” representation (not
26
+ # checked).
27
+ #
28
+ # New in version 3.3.
29
+ Py_ssize_t PyUnicode_GET_LENGTH(object o)
30
+
31
+ Py_UCS1 *PyUnicode_1BYTE_DATA(object o)
32
+ Py_UCS2 *PyUnicode_2BYTE_DATA(object o)
33
+ Py_UCS4 *PyUnicode_4BYTE_DATA(object o)
34
+
35
+ int PyUnicode_WCHAR_KIND # Deprecated since Python 3.10, removed in 3.12.
36
+ int PyUnicode_1BYTE_KIND
37
+ int PyUnicode_2BYTE_KIND
38
+ int PyUnicode_4BYTE_KIND
39
+ void PyUnicode_WRITE(int kind, void *data, Py_ssize_t index, Py_UCS4 value)
40
+ Py_UCS4 PyUnicode_READ(int kind, void *data, Py_ssize_t index)
41
+ Py_UCS4 PyUnicode_READ_CHAR(object o, Py_ssize_t index)
42
+
43
+ unsigned int PyUnicode_KIND(object o)
44
+ void *PyUnicode_DATA(object o)
45
+
46
+ # Return the size of the object's internal buffer in bytes. o has
47
+ # to be a PyUnicodeObject (not checked).
48
+ Py_ssize_t PyUnicode_GET_DATA_SIZE(object o)
49
+
50
+ # Return a pointer to the internal Py_UNICODE buffer of the
51
+ # object. o has to be a PyUnicodeObject (not checked).
52
+ Py_UNICODE* PyUnicode_AS_UNICODE(object o)
53
+
54
+ # Return a pointer to the internal buffer of the object. o has to
55
+ # be a PyUnicodeObject (not checked).
56
+ char* PyUnicode_AS_DATA(object o)
57
+
58
+ bint PyUnicode_IsIdentifier(object o)
59
+
60
+ # Return 1 or 0 depending on whether ch is a whitespace character.
61
+ bint Py_UNICODE_ISSPACE(Py_UCS4 ch)
62
+
63
+ # Return 1 or 0 depending on whether ch is a lowercase character.
64
+ bint Py_UNICODE_ISLOWER(Py_UCS4 ch)
65
+
66
+ # Return 1 or 0 depending on whether ch is an uppercase character.
67
+ bint Py_UNICODE_ISUPPER(Py_UCS4 ch)
68
+
69
+ # Return 1 or 0 depending on whether ch is a titlecase character.
70
+ bint Py_UNICODE_ISTITLE(Py_UCS4 ch)
71
+
72
+ # Return 1 or 0 depending on whether ch is a linebreak character.
73
+ bint Py_UNICODE_ISLINEBREAK(Py_UCS4 ch)
74
+
75
+ # Return 1 or 0 depending on whether ch is a decimal character.
76
+ bint Py_UNICODE_ISDECIMAL(Py_UCS4 ch)
77
+
78
+ # Return 1 or 0 depending on whether ch is a digit character.
79
+ bint Py_UNICODE_ISDIGIT(Py_UCS4 ch)
80
+
81
+ # Return 1 or 0 depending on whether ch is a numeric character.
82
+ bint Py_UNICODE_ISNUMERIC(Py_UCS4 ch)
83
+
84
+ # Return 1 or 0 depending on whether ch is an alphabetic character.
85
+ bint Py_UNICODE_ISALPHA(Py_UCS4 ch)
86
+
87
+ # Return 1 or 0 depending on whether ch is an alphanumeric character.
88
+ bint Py_UNICODE_ISALNUM(Py_UCS4 ch)
89
+
90
+ bint Py_UNICODE_ISPRINTABLE(Py_UCS4 ch)
91
+
92
+ # Return the character ch converted to lower case.
93
+ # Used to return a Py_UNICODE value before Py3.3.
94
+ Py_UCS4 Py_UNICODE_TOLOWER(Py_UCS4 ch)
95
+
96
+ # Return the character ch converted to upper case.
97
+ # Used to return a Py_UNICODE value before Py3.3.
98
+ Py_UCS4 Py_UNICODE_TOUPPER(Py_UCS4 ch)
99
+
100
+ # Return the character ch converted to title case.
101
+ # Used to return a Py_UNICODE value before Py3.3.
102
+ Py_UCS4 Py_UNICODE_TOTITLE(Py_UCS4 ch)
103
+
104
+ # Return the character ch converted to a decimal positive
105
+ # integer. Return -1 if this is not possible. This macro does not
106
+ # raise exceptions.
107
+ int Py_UNICODE_TODECIMAL(Py_UCS4 ch)
108
+
109
+ # Return the character ch converted to a single digit
110
+ # integer. Return -1 if this is not possible. This macro does not
111
+ # raise exceptions.
112
+ int Py_UNICODE_TODIGIT(Py_UCS4 ch)
113
+
114
+ # Return the character ch converted to a double. Return -1.0 if
115
+ # this is not possible. This macro does not raise exceptions.
116
+ double Py_UNICODE_TONUMERIC(Py_UCS4 ch)
117
+
118
+ # To create Unicode objects and access their basic sequence
119
+ # properties, use these APIs:
120
+
121
+ # Create a Unicode Object from the Py_UNICODE buffer u of the
122
+ # given size. u may be NULL which causes the contents to be
123
+ # undefined. It is the user's responsibility to fill in the needed
124
+ # data. The buffer is copied into the new object. If the buffer is
125
+ # not NULL, the return value might be a shared object. Therefore,
126
+ # modification of the resulting Unicode object is only allowed
127
+ # when u is NULL.
128
+ unicode PyUnicode_FromUnicode(Py_UNICODE *u, Py_ssize_t size)
129
+
130
+ # Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded
131
+ # bytes
132
+ unicode PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
133
+
134
+ # Similar to PyUnicode_FromUnicode(), but u points to null-terminated
135
+ # UTF-8 encoded bytes. The size is determined with strlen().
136
+ unicode PyUnicode_FromString(const char *u)
137
+
138
+ unicode PyUnicode_New(Py_ssize_t size, Py_UCS4 maxchar)
139
+ unicode PyUnicode_FromKindAndData(int kind, const void *buffer, Py_ssize_t size)
140
+ unicode PyUnicode_FromFormat(const char *format, ...)
141
+ Py_ssize_t PyUnicode_GetLength(object unicode) except -1
142
+ Py_ssize_t PyUnicode_CopyCharacters(object to, Py_ssize_t to_start, object from_, Py_ssize_t from_start, Py_ssize_t how_many) except -1
143
+ Py_ssize_t PyUnicode_Fill(object unicode, Py_ssize_t start, Py_ssize_t length, Py_UCS4 fill_char) except -1
144
+ int PyUnicode_WriteChar(object unicode, Py_ssize_t index, Py_UCS4 character) except -1
145
+ Py_UCS4 PyUnicode_ReadChar(object unicode, Py_ssize_t index) except -1
146
+ unicode PyUnicode_Substring(object str, Py_ssize_t start, Py_ssize_t end)
147
+ Py_UCS4 *PyUnicode_AsUCS4(object u, Py_UCS4 *buffer, Py_ssize_t buflen, int copy_null) except NULL
148
+ Py_UCS4 *PyUnicode_AsUCS4Copy(object u) except NULL
149
+
150
+ # Create a Unicode Object from the given Unicode code point ordinal.
151
+ #
152
+ # The ordinal must be in range(0x10000) on narrow Python builds
153
+ # (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError
154
+ # is raised in case it is not.
155
+ unicode PyUnicode_FromOrdinal(int ordinal)
156
+
157
+ # Return a read-only pointer to the Unicode object's internal
158
+ # Py_UNICODE buffer, NULL if unicode is not a Unicode object.
159
+ Py_UNICODE* PyUnicode_AsUnicode(object o) except NULL
160
+
161
+ # Return the length of the Unicode object.
162
+ Py_ssize_t PyUnicode_GetSize(object o) except -1
163
+
164
+ # Coerce an encoded object obj to an Unicode object and return a
165
+ # reference with incremented refcount.
166
+ # String and other char buffer compatible objects are decoded
167
+ # according to the given encoding and using the error handling
168
+ # defined by errors. Both can be NULL to have the interface use
169
+ # the default values (see the next section for details).
170
+ # All other objects, including Unicode objects, cause a TypeError
171
+ # to be set.
172
+ object PyUnicode_FromEncodedObject(object o, char *encoding, char *errors)
173
+
174
+ # Shortcut for PyUnicode_FromEncodedObject(obj, NULL, "strict")
175
+ # which is used throughout the interpreter whenever coercion to
176
+ # Unicode is needed.
177
+ object PyUnicode_FromObject(object obj)
178
+
179
+ # If the platform supports wchar_t and provides a header file
180
+ # wchar.h, Python can interface directly to this type using the
181
+ # following functions. Support is optimized if Python's own
182
+ # Py_UNICODE type is identical to the system's wchar_t.
183
+
184
+ # Create a Unicode object from the wchar_t buffer w of the given
185
+ # size. Return NULL on failure.
186
+ object PyUnicode_FromWideChar(wchar_t *w, Py_ssize_t size)
187
+
188
+ # Copy the Unicode object contents into the wchar_t buffer w.
189
+ # At most size wchar_t characters are copied (excluding a possibly
190
+ # trailing null termination character). Return the number of wchar_t
191
+ # characters copied or -1 in case of an error. Note that the
192
+ # esulting wchar_t* string may or may not be null-terminated.
193
+ # It is the responsibility of the caller to make sure that the wchar_t*
194
+ # string is null-terminated in case this is required by the application.
195
+ # Also, note that the wchar_t* string might contain null characters,
196
+ # which would cause the string to be truncated when used with most C functions.
197
+ Py_ssize_t PyUnicode_AsWideChar(object o, wchar_t *w, Py_ssize_t size) except -1
198
+
199
+ # Convert the Unicode object to a wide character string. The output
200
+ # string always ends with a null character. If size is not NULL,
201
+ # write the number of wide characters (excluding the trailing null
202
+ # termination character) into *size. Note that the resulting wchar_t
203
+ # string might contain null characters, which would cause the string
204
+ # to be truncated when used with most C functions. If size is NULL and
205
+ # the wchar_t* string contains null characters a ValueError is raised.
206
+
207
+ # Returns a buffer allocated by PyMem_New (use PyMem_Free() to free it)
208
+ # on success. On error, returns NULL and *size is undefined. Raises a
209
+ # MemoryError if memory allocation is failed.
210
+ wchar_t *PyUnicode_AsWideCharString(object o, Py_ssize_t *size) except NULL
211
+
212
+ # Unicode Methods
213
+
214
+ # Concat two strings giving a new Unicode string.
215
+ # Return value: New reference.
216
+ unicode PyUnicode_Concat(object left, object right)
217
+
218
+ # Split a string giving a list of Unicode strings. If sep is NULL,
219
+ # splitting will be done at all whitespace substrings. Otherwise,
220
+ # splits occur at the given separator. At most maxsplit splits will
221
+ # be done. If negative, no limit is set. Separators are not included
222
+ # in the resulting list.
223
+ # Return value: New reference.
224
+ list PyUnicode_Split(object s, object sep, Py_ssize_t maxsplit)
225
+
226
+ # Split a Unicode string at line breaks, returning a list of Unicode
227
+ # strings. CRLF is considered to be one line break. If keepend is 0,
228
+ # the Line break characters are not included in the resulting strings.
229
+ # Return value: New reference.
230
+ list PyUnicode_Splitlines(object s, bint keepend)
231
+
232
+ # Translate a string by applying a character mapping table to it and
233
+ # return the resulting Unicode object.
234
+ #
235
+ # The mapping table must map Unicode ordinal integers to Unicode ordinal
236
+ # integers or None (causing deletion of the character).
237
+ #
238
+ # Mapping tables need only provide the __getitem__() interface;
239
+ # dictionaries and sequences work well. Unmapped character ordinals (ones
240
+ # which cause a LookupError) are left untouched and are copied as-is.
241
+ #
242
+ # errors has the usual meaning for codecs. It may be NULL which indicates
243
+ # to use the default error handling.
244
+ # Return value: New reference.
245
+ unicode PyUnicode_Translate(object str, object table, const char *errors)
246
+
247
+ # Join a sequence of strings using the given separator and return the
248
+ # resulting Unicode string.
249
+ # Return value: New reference.
250
+ unicode PyUnicode_Join(object separator, object seq)
251
+
252
+ # Return 1 if substr matches str[start:end] at the given tail end
253
+ # (direction == -1 means to do a prefix match, direction == 1 a
254
+ # suffix match), 0 otherwise.
255
+ # Return -1 if an error occurred.
256
+ Py_ssize_t PyUnicode_Tailmatch(object str, object substr,
257
+ Py_ssize_t start, Py_ssize_t end, int direction) except -1
258
+
259
+ # Return the first position of substr in str[start:end] using the given
260
+ # direction (direction == 1 means to do a forward search, direction == -1
261
+ # a backward search). The return value is the index of the first match;
262
+ # a value of -1 indicates that no match was found, and -2 indicates that an
263
+ # error occurred and an exception has been set.
264
+ Py_ssize_t PyUnicode_Find(object str, object substr, Py_ssize_t start, Py_ssize_t end, int direction) except -2
265
+
266
+ # Return the first position of the character ch in str[start:end] using
267
+ # the given direction (direction == 1 means to do a forward search,
268
+ # direction == -1 a backward search). The return value is the index of
269
+ # the first match; a value of -1 indicates that no match was found, and
270
+ # -2 indicates that an error occurred and an exception has been set.
271
+ # New in version 3.3.
272
+ Py_ssize_t PyUnicode_FindChar(object str, Py_UCS4 ch, Py_ssize_t start, Py_ssize_t end, int direction) except -2
273
+
274
+ # Return the number of non-overlapping occurrences of substr in
275
+ # str[start:end]. Return -1 if an error occurred.
276
+ Py_ssize_t PyUnicode_Count(object str, object substr, Py_ssize_t start, Py_ssize_t end) except -1
277
+
278
+ # Replace at most maxcount occurrences of substr in str with replstr and
279
+ # return the resulting Unicode object. maxcount == -1 means replace all
280
+ # occurrences.
281
+ # Return value: New reference.
282
+ unicode PyUnicode_Replace(object str, object substr, object replstr, Py_ssize_t maxcount)
283
+
284
+ # Compare two strings and return -1, 0, 1 for less than,
285
+ # equal, and greater than, respectively.
286
+ int PyUnicode_Compare(object left, object right) except? -1
287
+
288
+ # Compare a unicode object, uni, with string and return -1, 0, 1 for less than,
289
+ # equal, and greater than, respectively. It is best to pass only ASCII-encoded
290
+ # strings, but the function interprets the input string as ISO-8859-1 if it
291
+ # contains non-ASCII characters.
292
+ int PyUnicode_CompareWithASCIIString(object uni, const char *string)
293
+
294
+ # Rich compare two unicode strings and return one of the following:
295
+ #
296
+ # NULL in case an exception was raised
297
+ # Py_True or Py_False for successful comparisons
298
+ # Py_NotImplemented in case the type combination is unknown
299
+ #
300
+ # Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in case
301
+ # the conversion of the arguments to Unicode fails with a UnicodeDecodeError.
302
+ #
303
+ # Possible values for op are Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, and Py_LE.
304
+ object PyUnicode_RichCompare(object left, object right, int op)
305
+
306
+ # Return a new string object from format and args; this is analogous to
307
+ # format % args.
308
+ # Return value: New reference.
309
+ unicode PyUnicode_Format(object format, object args)
310
+
311
+ # Check whether element is contained in container and return true or false
312
+ # accordingly.
313
+ #
314
+ # element has to coerce to a one element Unicode string. -1 is returned
315
+ # if there was an error.
316
+ int PyUnicode_Contains(object container, object element) except -1
317
+
318
+ # Intern the argument *string in place. The argument must be the address
319
+ # of a pointer variable pointing to a Python unicode string object. If
320
+ # there is an existing interned string that is the same as *string, it sets
321
+ # *string to it (decrementing the reference count of the old string object
322
+ # and incrementing the reference count of the interned string object),
323
+ # otherwise it leaves *string alone and interns it (incrementing its reference
324
+ # count). (Clarification: even though there is a lot of talk about reference
325
+ # counts, think of this function as reference-count-neutral; you own the object
326
+ # after the call if and only if you owned it before the call.)
327
+ #void PyUnicode_InternInPlace(PyObject **string)
328
+
329
+ # A combination of PyUnicode_FromString() and PyUnicode_InternInPlace(),
330
+ # returning either a new unicode string object that has been interned, or
331
+ # a new ("owned") reference to an earlier interned string object with the
332
+ # same value.
333
+ unicode PyUnicode_InternFromString(const char *v)
334
+
335
+
336
+ # Codecs
337
+
338
+ # Create a Unicode object by decoding size bytes of the encoded
339
+ # string s. encoding and errors have the same meaning as the
340
+ # parameters of the same name in the unicode() builtin
341
+ # function. The codec to be used is looked up using the Python
342
+ # codec registry. Return NULL if an exception was raised by the
343
+ # codec.
344
+ object PyUnicode_Decode(char *s, Py_ssize_t size, char *encoding, char *errors)
345
+
346
+ # Encode the Py_UNICODE buffer of the given size and return a
347
+ # Python string object. encoding and errors have the same meaning
348
+ # as the parameters of the same name in the Unicode encode()
349
+ # method. The codec to be used is looked up using the Python codec
350
+ # registry. Return NULL if an exception was raised by the codec.
351
+ object PyUnicode_Encode(Py_UNICODE *s, Py_ssize_t size,
352
+ char *encoding, char *errors)
353
+
354
+ # Encode a Unicode object and return the result as Python string
355
+ # object. encoding and errors have the same meaning as the
356
+ # parameters of the same name in the Unicode encode() method. The
357
+ # codec to be used is looked up using the Python codec
358
+ # registry. Return NULL if an exception was raised by the codec.
359
+ object PyUnicode_AsEncodedString(object unicode, char *encoding, char *errors)
360
+
361
+ # These are the UTF-8 codec APIs:
362
+
363
+ # Create a Unicode object by decoding size bytes of the UTF-8
364
+ # encoded string s. Return NULL if an exception was raised by the
365
+ # codec.
366
+ unicode PyUnicode_DecodeUTF8(char *s, Py_ssize_t size, char *errors)
367
+
368
+ # If consumed is NULL, behave like PyUnicode_DecodeUTF8(). If
369
+ # consumed is not NULL, trailing incomplete UTF-8 byte sequences
370
+ # will not be treated as an error. Those bytes will not be decoded
371
+ # and the number of bytes that have been decoded will be stored in
372
+ # consumed. New in version 2.4.
373
+ unicode PyUnicode_DecodeUTF8Stateful(char *s, Py_ssize_t size, char *errors, Py_ssize_t *consumed)
374
+
375
+ # Encode the Py_UNICODE buffer of the given size using UTF-8 and
376
+ # return a Python string object. Return NULL if an exception was
377
+ # raised by the codec.
378
+ bytes PyUnicode_EncodeUTF8(Py_UNICODE *s, Py_ssize_t size, char *errors)
379
+
380
+ # Encode a Unicode objects using UTF-8 and return the result as Python bytes object. Error handling is ``strict''. Return NULL if an exception was raised by the codec.
381
+ bytes PyUnicode_AsUTF8String(object unicode)
382
+
383
+
384
+ # Return a pointer to the UTF-8 encoding of the Unicode object,
385
+ # and store the size of the encoded representation (in bytes) in size.
386
+ # The size argument can be NULL; in this case no size will be stored.
387
+ # The returned buffer always has an extra null byte appended
388
+ # (not included in size), regardless of whether there are any
389
+ # other null code points.
390
+
391
+ # In the case of an error, NULL is returned with an exception set and
392
+ # no size is stored.
393
+
394
+ # This caches the UTF-8 representation of the string in the Unicode
395
+ # object, and subsequent calls will return a pointer to the same buffer.
396
+ # The caller is not responsible for deallocating the buffer
397
+ const char* PyUnicode_AsUTF8AndSize(object unicode, Py_ssize_t *size) except NULL
398
+
399
+
400
+ # As PyUnicode_AsUTF8AndSize(), but does not store the size.
401
+ const char *PyUnicode_AsUTF8(object unicode) except NULL
402
+
403
+ # These are the UTF-16 codec APIs:
404
+
405
+ # Decode length bytes from a UTF-16 encoded buffer string and
406
+ # return the corresponding Unicode object. errors (if non-NULL)
407
+ # defines the error handling. It defaults to ``strict''.
408
+ #
409
+ # If byteorder is non-NULL, the decoder starts decoding using the
410
+ # given byte order:
411
+ #
412
+ # *byteorder == -1: little endian
413
+ # *byteorder == 0: native order
414
+ # *byteorder == 1: big endian
415
+ #
416
+ # and then switches if the first two bytes of the input data are a
417
+ # byte order mark (BOM) and the specified byte order is native
418
+ # order. This BOM is not copied into the resulting Unicode
419
+ # string. After completion, *byteorder is set to the current byte
420
+ # order at the.
421
+ #
422
+ # If byteorder is NULL, the codec starts in native order mode.
423
+ unicode PyUnicode_DecodeUTF16(char *s, Py_ssize_t size, char *errors, int *byteorder)
424
+
425
+ # If consumed is NULL, behave like PyUnicode_DecodeUTF16(). If
426
+ # consumed is not NULL, PyUnicode_DecodeUTF16Stateful() will not
427
+ # treat trailing incomplete UTF-16 byte sequences (such as an odd
428
+ # number of bytes or a split surrogate pair) as an error. Those
429
+ # bytes will not be decoded and the number of bytes that have been
430
+ # decoded will be stored in consumed. New in version 2.4.
431
+ unicode PyUnicode_DecodeUTF16Stateful(char *s, Py_ssize_t size, char *errors, int *byteorder, Py_ssize_t *consumed)
432
+
433
+ # Return a Python string object holding the UTF-16 encoded value
434
+ # of the Unicode data in s. If byteorder is not 0, output is
435
+ # written according to the following byte order:
436
+ #
437
+ # byteorder == -1: little endian
438
+ # byteorder == 0: native byte order (writes a BOM mark)
439
+ # byteorder == 1: big endian
440
+ #
441
+ # If byteorder is 0, the output string will always start with the
442
+ # Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark
443
+ # is prepended.
444
+ #
445
+ # If Py_UNICODE_WIDE is defined, a single Py_UNICODE value may get
446
+ # represented as a surrogate pair. If it is not defined, each
447
+ # Py_UNICODE values is interpreted as an UCS-2 character.
448
+ bytes PyUnicode_EncodeUTF16(Py_UNICODE *s, Py_ssize_t size, char *errors, int byteorder)
449
+
450
+ # Return a Python string using the UTF-16 encoding in native byte
451
+ # order. The string always starts with a BOM mark. Error handling
452
+ # is ``strict''. Return NULL if an exception was raised by the
453
+ # codec.
454
+ bytes PyUnicode_AsUTF16String(object unicode)
455
+
456
+ # These are the ``Unicode Escape'' codec APIs:
457
+
458
+ # Create a Unicode object by decoding size bytes of the
459
+ # Unicode-Escape encoded string s. Return NULL if an exception was
460
+ # raised by the codec.
461
+ object PyUnicode_DecodeUnicodeEscape(char *s, Py_ssize_t size, char *errors)
462
+
463
+ # Encode the Py_UNICODE buffer of the given size using
464
+ # Unicode-Escape and return a Python string object. Return NULL if
465
+ # an exception was raised by the codec.
466
+ object PyUnicode_EncodeUnicodeEscape(Py_UNICODE *s, Py_ssize_t size)
467
+
468
+ # Encode a Unicode objects using Unicode-Escape and return the
469
+ # result as Python string object. Error handling is
470
+ # ``strict''. Return NULL if an exception was raised by the codec.
471
+ object PyUnicode_AsUnicodeEscapeString(object unicode)
472
+
473
+ # These are the ``Raw Unicode Escape'' codec APIs:
474
+
475
+ # Create a Unicode object by decoding size bytes of the
476
+ # Raw-Unicode-Escape encoded string s. Return NULL if an exception
477
+ # was raised by the codec.
478
+ object PyUnicode_DecodeRawUnicodeEscape(char *s, Py_ssize_t size, char *errors)
479
+
480
+ # Encode the Py_UNICODE buffer of the given size using
481
+ # Raw-Unicode-Escape and return a Python string object. Return
482
+ # NULL if an exception was raised by the codec.
483
+ object PyUnicode_EncodeRawUnicodeEscape(Py_UNICODE *s, Py_ssize_t size, char *errors)
484
+
485
+ # Encode a Unicode objects using Raw-Unicode-Escape and return the
486
+ # result as Python string object. Error handling is
487
+ # ``strict''. Return NULL if an exception was raised by the codec.
488
+ object PyUnicode_AsRawUnicodeEscapeString(object unicode)
489
+
490
+ # These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 Unicode ordinals and only these are accepted by the codecs during encoding.
491
+
492
+ # Create a Unicode object by decoding size bytes of the Latin-1
493
+ # encoded string s. Return NULL if an exception was raised by the
494
+ # codec.
495
+ unicode PyUnicode_DecodeLatin1(char *s, Py_ssize_t size, char *errors)
496
+
497
+ # Encode the Py_UNICODE buffer of the given size using Latin-1 and
498
+ # return a Python bytes object. Return NULL if an exception was
499
+ # raised by the codec.
500
+ bytes PyUnicode_EncodeLatin1(Py_UNICODE *s, Py_ssize_t size, char *errors)
501
+
502
+ # Encode a Unicode objects using Latin-1 and return the result as
503
+ # Python bytes object. Error handling is ``strict''. Return NULL
504
+ # if an exception was raised by the codec.
505
+ bytes PyUnicode_AsLatin1String(object unicode)
506
+
507
+ # These are the ASCII codec APIs. Only 7-bit ASCII data is
508
+ # accepted. All other codes generate errors.
509
+
510
+ # Create a Unicode object by decoding size bytes of the ASCII
511
+ # encoded string s. Return NULL if an exception was raised by the
512
+ # codec.
513
+ unicode PyUnicode_DecodeASCII(char *s, Py_ssize_t size, char *errors)
514
+
515
+ # Encode the Py_UNICODE buffer of the given size using ASCII and
516
+ # return a Python bytes object. Return NULL if an exception was
517
+ # raised by the codec.
518
+ bytes PyUnicode_EncodeASCII(Py_UNICODE *s, Py_ssize_t size, char *errors)
519
+
520
+ # Encode a Unicode objects using ASCII and return the result as
521
+ # Python bytes object. Error handling is ``strict''. Return NULL
522
+ # if an exception was raised by the codec.
523
+ bytes PyUnicode_AsASCIIString(object o)
524
+
525
+ # These are the mapping codec APIs:
526
+ #
527
+ # This codec is special in that it can be used to implement many
528
+ # different codecs (and this is in fact what was done to obtain most
529
+ # of the standard codecs included in the encodings package). The codec
530
+ # uses mapping to encode and decode characters.
531
+ #
532
+ # Decoding mappings must map single string characters to single
533
+ # Unicode characters, integers (which are then interpreted as Unicode
534
+ # ordinals) or None (meaning "undefined mapping" and causing an
535
+ # error).
536
+ #
537
+ # Encoding mappings must map single Unicode characters to single
538
+ # string characters, integers (which are then interpreted as Latin-1
539
+ # ordinals) or None (meaning "undefined mapping" and causing an
540
+ # error).
541
+ #
542
+ # The mapping objects provided must only support the __getitem__
543
+ # mapping interface.
544
+ #
545
+ # If a character lookup fails with a LookupError, the character is
546
+ # copied as-is meaning that its ordinal value will be interpreted as
547
+ # Unicode or Latin-1 ordinal resp. Because of this, mappings only need
548
+ # to contain those mappings which map characters to different code
549
+ # points.
550
+
551
+ # Create a Unicode object by decoding size bytes of the encoded
552
+ # string s using the given mapping object. Return NULL if an
553
+ # exception was raised by the codec. If mapping is NULL latin-1
554
+ # decoding will be done. Else it can be a dictionary mapping byte
555
+ # or a unicode string, which is treated as a lookup table. Byte
556
+ # values greater that the length of the string and U+FFFE
557
+ # "characters" are treated as "undefined mapping". Changed in
558
+ # version 2.4: Allowed unicode string as mapping argument.
559
+ object PyUnicode_DecodeCharmap(char *s, Py_ssize_t size, object mapping, char *errors)
560
+
561
+ # Encode the Py_UNICODE buffer of the given size using the given
562
+ # mapping object and return a Python string object. Return NULL if
563
+ # an exception was raised by the codec.
564
+ #
565
+ # Deprecated since version 3.3, will be removed in version 4.0.
566
+ object PyUnicode_EncodeCharmap(Py_UNICODE *s, Py_ssize_t size, object mapping, char *errors)
567
+
568
+ # Encode a Unicode objects using the given mapping object and
569
+ # return the result as Python string object. Error handling is
570
+ # ``strict''. Return NULL if an exception was raised by the codec.
571
+ object PyUnicode_AsCharmapString(object o, object mapping)
572
+
573
+ # The following codec API is special in that maps Unicode to Unicode.
574
+
575
+ # Translate a Py_UNICODE buffer of the given length by applying a
576
+ # character mapping table to it and return the resulting Unicode
577
+ # object. Return NULL when an exception was raised by the codec.
578
+ #
579
+ # The mapping table must map Unicode ordinal integers to Unicode
580
+ # ordinal integers or None (causing deletion of the character).
581
+ #
582
+ # Mapping tables need only provide the __getitem__() interface;
583
+ # dictionaries and sequences work well. Unmapped character
584
+ # ordinals (ones which cause a LookupError) are left untouched and
585
+ # are copied as-is.
586
+ #
587
+ # Deprecated since version 3.3, will be removed in version 4.0.
588
+ object PyUnicode_TranslateCharmap(Py_UNICODE *s, Py_ssize_t size,
589
+ object table, char *errors)
590
+
591
+ # These are the MBCS codec APIs. They are currently only available on
592
+ # Windows and use the Win32 MBCS converters to implement the
593
+ # conversions. Note that MBCS (or DBCS) is a class of encodings, not
594
+ # just one. The target encoding is defined by the user settings on the
595
+ # machine running the codec.
596
+
597
+ # Create a Unicode object by decoding size bytes of the MBCS
598
+ # encoded string s. Return NULL if an exception was raised by the
599
+ # codec.
600
+ unicode PyUnicode_DecodeMBCS(char *s, Py_ssize_t size, char *errors)
601
+
602
+ # If consumed is NULL, behave like PyUnicode_DecodeMBCS(). If
603
+ # consumed is not NULL, PyUnicode_DecodeMBCSStateful() will not
604
+ # decode trailing lead byte and the number of bytes that have been
605
+ # decoded will be stored in consumed. New in version 2.5.
606
+ # NOTE: Python 2.x uses 'int' values for 'size' and 'consumed' (changed in 3.0)
607
+ unicode PyUnicode_DecodeMBCSStateful(char *s, Py_ssize_t size, char *errors, Py_ssize_t *consumed)
608
+
609
+ # Encode the Py_UNICODE buffer of the given size using MBCS and
610
+ # return a Python string object. Return NULL if an exception was
611
+ # raised by the codec.
612
+ bytes PyUnicode_EncodeMBCS(Py_UNICODE *s, Py_ssize_t size, char *errors)
613
+
614
+ # Encode a Unicode objects using MBCS and return the result as
615
+ # Python string object. Error handling is ``strict''. Return NULL
616
+ # if an exception was raised by the codec.
617
+ bytes PyUnicode_AsMBCSString(object o)
618
+
619
+ # Encode the Unicode object using the specified code page and return
620
+ # a Python bytes object. Return NULL if an exception was raised by the
621
+ # codec. Use CP_ACP code page to get the MBCS encoder.
622
+ #
623
+ # New in version 3.3.
624
+ bytes PyUnicode_EncodeCodePage(int code_page, object unicode, const char *errors)
625
+
626
+
627
+ # Py_UCS4 helpers (new in CPython 3.3)
628
+
629
+ # These utility functions work on strings of Py_UCS4 characters and
630
+ # otherwise behave like the C standard library functions with the same name.
631
+
632
+ size_t Py_UCS4_strlen(const Py_UCS4 *u)
633
+ Py_UCS4* Py_UCS4_strcpy(Py_UCS4 *s1, const Py_UCS4 *s2)
634
+ Py_UCS4* Py_UCS4_strncpy(Py_UCS4 *s1, const Py_UCS4 *s2, size_t n)
635
+ Py_UCS4* Py_UCS4_strcat(Py_UCS4 *s1, const Py_UCS4 *s2)
636
+ int Py_UCS4_strcmp(const Py_UCS4 *s1, const Py_UCS4 *s2)
637
+ int Py_UCS4_strncmp(const Py_UCS4 *s1, const Py_UCS4 *s2, size_t n)
638
+ Py_UCS4* Py_UCS4_strchr(const Py_UCS4 *s, Py_UCS4 c)
639
+ Py_UCS4* Py_UCS4_strrchr(const Py_UCS4 *s, Py_UCS4 c)
@@ -0,0 +1,32 @@
1
+ # Python version constants
2
+ #
3
+ # It's better to evaluate these at runtime (i.e. C compile time) using
4
+ #
5
+ # if PY_MAJOR_VERSION >= 3:
6
+ # do_stuff_in_Py3_0_and_later()
7
+ # if PY_VERSION_HEX >= 0x02070000:
8
+ # do_stuff_in_Py2_7_and_later()
9
+ #
10
+ # than using the IF/DEF statements, which are evaluated at Cython
11
+ # compile time. This will keep your C code portable.
12
+
13
+
14
+ cdef extern from *:
15
+ # the complete version, e.g. 0x010502B2 == 1.5.2b2
16
+ int PY_VERSION_HEX
17
+
18
+ # the individual sections as plain numbers
19
+ int PY_MAJOR_VERSION
20
+ int PY_MINOR_VERSION
21
+ int PY_MICRO_VERSION
22
+ int PY_RELEASE_LEVEL
23
+ int PY_RELEASE_SERIAL
24
+
25
+ # Note: PY_RELEASE_LEVEL is one of
26
+ # 0xA (alpha)
27
+ # 0xB (beta)
28
+ # 0xC (release candidate)
29
+ # 0xF (final)
30
+
31
+ char PY_VERSION[]
32
+ char PY_PATCHLEVEL_REVISION[]