Cython 3.1.0a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. Cython/Build/BuildExecutable.py +169 -0
  2. Cython/Build/Cache.py +199 -0
  3. Cython/Build/Cythonize.py +250 -0
  4. Cython/Build/Dependencies.py +1275 -0
  5. Cython/Build/Distutils.py +1 -0
  6. Cython/Build/Inline.py +342 -0
  7. Cython/Build/IpythonMagic.py +560 -0
  8. Cython/Build/Tests/TestCyCache.py +119 -0
  9. Cython/Build/Tests/TestCythonizeArgsParser.py +481 -0
  10. Cython/Build/Tests/TestDependencies.py +133 -0
  11. Cython/Build/Tests/TestInline.py +112 -0
  12. Cython/Build/Tests/TestIpythonMagic.py +287 -0
  13. Cython/Build/Tests/TestRecythonize.py +212 -0
  14. Cython/Build/Tests/TestStripLiterals.py +155 -0
  15. Cython/Build/Tests/__init__.py +1 -0
  16. Cython/Build/__init__.py +8 -0
  17. Cython/CodeWriter.py +811 -0
  18. Cython/Compiler/AnalysedTreeTransforms.py +97 -0
  19. Cython/Compiler/Annotate.py +326 -0
  20. Cython/Compiler/AutoDocTransforms.py +314 -0
  21. Cython/Compiler/Buffer.py +680 -0
  22. Cython/Compiler/Builtin.py +862 -0
  23. Cython/Compiler/CmdLine.py +243 -0
  24. Cython/Compiler/Code.pxd +145 -0
  25. Cython/Compiler/Code.py +3328 -0
  26. Cython/Compiler/CodeGeneration.py +33 -0
  27. Cython/Compiler/CythonScope.py +179 -0
  28. Cython/Compiler/Dataclass.py +868 -0
  29. Cython/Compiler/DebugFlags.py +21 -0
  30. Cython/Compiler/Errors.py +295 -0
  31. Cython/Compiler/ExprNodes.py +15051 -0
  32. Cython/Compiler/FlowControl.pxd +97 -0
  33. Cython/Compiler/FlowControl.py +1438 -0
  34. Cython/Compiler/FusedNode.py +998 -0
  35. Cython/Compiler/Future.py +16 -0
  36. Cython/Compiler/Interpreter.py +57 -0
  37. Cython/Compiler/Lexicon.py +340 -0
  38. Cython/Compiler/LineTable.py +114 -0
  39. Cython/Compiler/Main.py +779 -0
  40. Cython/Compiler/MatchCaseNodes.py +259 -0
  41. Cython/Compiler/MemoryView.py +860 -0
  42. Cython/Compiler/ModuleNode.py +4065 -0
  43. Cython/Compiler/Naming.py +369 -0
  44. Cython/Compiler/Nodes.py +10557 -0
  45. Cython/Compiler/Optimize.py +5269 -0
  46. Cython/Compiler/Options.py +828 -0
  47. Cython/Compiler/ParseTreeTransforms.pxd +78 -0
  48. Cython/Compiler/ParseTreeTransforms.py +4441 -0
  49. Cython/Compiler/Parsing.pxd +9 -0
  50. Cython/Compiler/Parsing.py +4797 -0
  51. Cython/Compiler/Pipeline.py +425 -0
  52. Cython/Compiler/PyrexTypes.py +5572 -0
  53. Cython/Compiler/Pythran.py +223 -0
  54. Cython/Compiler/Scanning.pxd +40 -0
  55. Cython/Compiler/Scanning.py +574 -0
  56. Cython/Compiler/StringEncoding.py +347 -0
  57. Cython/Compiler/Symtab.py +2998 -0
  58. Cython/Compiler/Tests/TestBuffer.py +105 -0
  59. Cython/Compiler/Tests/TestBuiltin.py +72 -0
  60. Cython/Compiler/Tests/TestCmdLine.py +573 -0
  61. Cython/Compiler/Tests/TestCode.py +86 -0
  62. Cython/Compiler/Tests/TestFlowControl.py +65 -0
  63. Cython/Compiler/Tests/TestGrammar.py +202 -0
  64. Cython/Compiler/Tests/TestMemView.py +71 -0
  65. Cython/Compiler/Tests/TestParseTreeTransforms.py +285 -0
  66. Cython/Compiler/Tests/TestScanning.py +134 -0
  67. Cython/Compiler/Tests/TestSignatureMatching.py +73 -0
  68. Cython/Compiler/Tests/TestStringEncoding.py +33 -0
  69. Cython/Compiler/Tests/TestTreeFragment.py +63 -0
  70. Cython/Compiler/Tests/TestTreePath.py +93 -0
  71. Cython/Compiler/Tests/TestTypes.py +75 -0
  72. Cython/Compiler/Tests/TestUtilityLoad.py +112 -0
  73. Cython/Compiler/Tests/TestVisitor.py +61 -0
  74. Cython/Compiler/Tests/Utils.py +36 -0
  75. Cython/Compiler/Tests/__init__.py +1 -0
  76. Cython/Compiler/TreeFragment.py +278 -0
  77. Cython/Compiler/TreePath.py +290 -0
  78. Cython/Compiler/TypeInference.py +584 -0
  79. Cython/Compiler/TypeSlots.py +1181 -0
  80. Cython/Compiler/UFuncs.py +311 -0
  81. Cython/Compiler/UtilNodes.py +387 -0
  82. Cython/Compiler/UtilityCode.py +274 -0
  83. Cython/Compiler/Version.py +8 -0
  84. Cython/Compiler/Visitor.pxd +53 -0
  85. Cython/Compiler/Visitor.py +861 -0
  86. Cython/Compiler/__init__.py +1 -0
  87. Cython/Coverage.py +443 -0
  88. Cython/Debugger/Cygdb.py +179 -0
  89. Cython/Debugger/DebugWriter.py +82 -0
  90. Cython/Debugger/Tests/TestLibCython.py +275 -0
  91. Cython/Debugger/Tests/__init__.py +1 -0
  92. Cython/Debugger/Tests/cfuncs.c +8 -0
  93. Cython/Debugger/Tests/codefile +49 -0
  94. Cython/Debugger/Tests/test_libcython_in_gdb.py +578 -0
  95. Cython/Debugger/Tests/test_libpython_in_gdb.py +90 -0
  96. Cython/Debugger/__init__.py +1 -0
  97. Cython/Debugger/libcython.py +1549 -0
  98. Cython/Debugger/libpython.py +2821 -0
  99. Cython/Debugging.py +20 -0
  100. Cython/Distutils/__init__.py +2 -0
  101. Cython/Distutils/build_ext.py +137 -0
  102. Cython/Distutils/extension.py +96 -0
  103. Cython/Distutils/old_build_ext.py +351 -0
  104. Cython/Includes/cpython/__init__.pxd +173 -0
  105. Cython/Includes/cpython/array.pxd +174 -0
  106. Cython/Includes/cpython/bool.pxd +37 -0
  107. Cython/Includes/cpython/buffer.pxd +112 -0
  108. Cython/Includes/cpython/bytearray.pxd +33 -0
  109. Cython/Includes/cpython/bytes.pxd +200 -0
  110. Cython/Includes/cpython/cellobject.pxd +35 -0
  111. Cython/Includes/cpython/ceval.pxd +8 -0
  112. Cython/Includes/cpython/codecs.pxd +121 -0
  113. Cython/Includes/cpython/complex.pxd +55 -0
  114. Cython/Includes/cpython/contextvars.pxd +141 -0
  115. Cython/Includes/cpython/conversion.pxd +36 -0
  116. Cython/Includes/cpython/datetime.pxd +384 -0
  117. Cython/Includes/cpython/descr.pxd +26 -0
  118. Cython/Includes/cpython/dict.pxd +187 -0
  119. Cython/Includes/cpython/exc.pxd +263 -0
  120. Cython/Includes/cpython/fileobject.pxd +57 -0
  121. Cython/Includes/cpython/float.pxd +47 -0
  122. Cython/Includes/cpython/function.pxd +65 -0
  123. Cython/Includes/cpython/genobject.pxd +25 -0
  124. Cython/Includes/cpython/getargs.pxd +12 -0
  125. Cython/Includes/cpython/instance.pxd +25 -0
  126. Cython/Includes/cpython/iterator.pxd +36 -0
  127. Cython/Includes/cpython/iterobject.pxd +24 -0
  128. Cython/Includes/cpython/list.pxd +92 -0
  129. Cython/Includes/cpython/long.pxd +149 -0
  130. Cython/Includes/cpython/longintrepr.pxd +19 -0
  131. Cython/Includes/cpython/mapping.pxd +63 -0
  132. Cython/Includes/cpython/marshal.pxd +66 -0
  133. Cython/Includes/cpython/mem.pxd +120 -0
  134. Cython/Includes/cpython/memoryview.pxd +50 -0
  135. Cython/Includes/cpython/method.pxd +49 -0
  136. Cython/Includes/cpython/module.pxd +208 -0
  137. Cython/Includes/cpython/number.pxd +258 -0
  138. Cython/Includes/cpython/object.pxd +433 -0
  139. Cython/Includes/cpython/pycapsule.pxd +143 -0
  140. Cython/Includes/cpython/pylifecycle.pxd +68 -0
  141. Cython/Includes/cpython/pyport.pxd +8 -0
  142. Cython/Includes/cpython/pystate.pxd +95 -0
  143. Cython/Includes/cpython/pythread.pxd +53 -0
  144. Cython/Includes/cpython/ref.pxd +67 -0
  145. Cython/Includes/cpython/sequence.pxd +134 -0
  146. Cython/Includes/cpython/set.pxd +119 -0
  147. Cython/Includes/cpython/slice.pxd +70 -0
  148. Cython/Includes/cpython/time.pxd +129 -0
  149. Cython/Includes/cpython/tuple.pxd +72 -0
  150. Cython/Includes/cpython/type.pxd +53 -0
  151. Cython/Includes/cpython/unicode.pxd +639 -0
  152. Cython/Includes/cpython/version.pxd +32 -0
  153. Cython/Includes/cpython/weakref.pxd +42 -0
  154. Cython/Includes/libc/__init__.pxd +1 -0
  155. Cython/Includes/libc/complex.pxd +35 -0
  156. Cython/Includes/libc/errno.pxd +127 -0
  157. Cython/Includes/libc/float.pxd +43 -0
  158. Cython/Includes/libc/limits.pxd +28 -0
  159. Cython/Includes/libc/locale.pxd +46 -0
  160. Cython/Includes/libc/math.pxd +209 -0
  161. Cython/Includes/libc/setjmp.pxd +10 -0
  162. Cython/Includes/libc/signal.pxd +64 -0
  163. Cython/Includes/libc/stddef.pxd +9 -0
  164. Cython/Includes/libc/stdint.pxd +105 -0
  165. Cython/Includes/libc/stdio.pxd +80 -0
  166. Cython/Includes/libc/stdlib.pxd +72 -0
  167. Cython/Includes/libc/string.pxd +50 -0
  168. Cython/Includes/libc/time.pxd +47 -0
  169. Cython/Includes/libcpp/__init__.pxd +4 -0
  170. Cython/Includes/libcpp/algorithm.pxd +320 -0
  171. Cython/Includes/libcpp/any.pxd +16 -0
  172. Cython/Includes/libcpp/atomic.pxd +59 -0
  173. Cython/Includes/libcpp/bit.pxd +29 -0
  174. Cython/Includes/libcpp/cast.pxd +12 -0
  175. Cython/Includes/libcpp/cmath.pxd +518 -0
  176. Cython/Includes/libcpp/complex.pxd +106 -0
  177. Cython/Includes/libcpp/deque.pxd +165 -0
  178. Cython/Includes/libcpp/execution.pxd +15 -0
  179. Cython/Includes/libcpp/forward_list.pxd +63 -0
  180. Cython/Includes/libcpp/functional.pxd +26 -0
  181. Cython/Includes/libcpp/iterator.pxd +34 -0
  182. Cython/Includes/libcpp/limits.pxd +61 -0
  183. Cython/Includes/libcpp/list.pxd +117 -0
  184. Cython/Includes/libcpp/map.pxd +252 -0
  185. Cython/Includes/libcpp/memory.pxd +115 -0
  186. Cython/Includes/libcpp/numbers.pxd +15 -0
  187. Cython/Includes/libcpp/numeric.pxd +131 -0
  188. Cython/Includes/libcpp/optional.pxd +34 -0
  189. Cython/Includes/libcpp/pair.pxd +1 -0
  190. Cython/Includes/libcpp/queue.pxd +25 -0
  191. Cython/Includes/libcpp/random.pxd +166 -0
  192. Cython/Includes/libcpp/set.pxd +228 -0
  193. Cython/Includes/libcpp/stack.pxd +11 -0
  194. Cython/Includes/libcpp/string.pxd +333 -0
  195. Cython/Includes/libcpp/typeindex.pxd +15 -0
  196. Cython/Includes/libcpp/typeinfo.pxd +10 -0
  197. Cython/Includes/libcpp/unordered_map.pxd +193 -0
  198. Cython/Includes/libcpp/unordered_set.pxd +152 -0
  199. Cython/Includes/libcpp/utility.pxd +30 -0
  200. Cython/Includes/libcpp/vector.pxd +167 -0
  201. Cython/Includes/openmp.pxd +50 -0
  202. Cython/Includes/posix/__init__.pxd +1 -0
  203. Cython/Includes/posix/dlfcn.pxd +14 -0
  204. Cython/Includes/posix/fcntl.pxd +86 -0
  205. Cython/Includes/posix/ioctl.pxd +4 -0
  206. Cython/Includes/posix/mman.pxd +101 -0
  207. Cython/Includes/posix/resource.pxd +57 -0
  208. Cython/Includes/posix/select.pxd +21 -0
  209. Cython/Includes/posix/signal.pxd +73 -0
  210. Cython/Includes/posix/stat.pxd +98 -0
  211. Cython/Includes/posix/stdio.pxd +37 -0
  212. Cython/Includes/posix/stdlib.pxd +29 -0
  213. Cython/Includes/posix/strings.pxd +9 -0
  214. Cython/Includes/posix/time.pxd +71 -0
  215. Cython/Includes/posix/types.pxd +30 -0
  216. Cython/Includes/posix/uio.pxd +26 -0
  217. Cython/Includes/posix/unistd.pxd +271 -0
  218. Cython/Includes/posix/wait.pxd +38 -0
  219. Cython/Plex/Actions.pxd +24 -0
  220. Cython/Plex/Actions.py +119 -0
  221. Cython/Plex/DFA.pxd +14 -0
  222. Cython/Plex/DFA.py +164 -0
  223. Cython/Plex/Errors.py +48 -0
  224. Cython/Plex/Lexicons.py +178 -0
  225. Cython/Plex/Machines.pxd +36 -0
  226. Cython/Plex/Machines.py +238 -0
  227. Cython/Plex/Regexps.py +539 -0
  228. Cython/Plex/Scanners.pxd +47 -0
  229. Cython/Plex/Scanners.py +360 -0
  230. Cython/Plex/Transitions.pxd +14 -0
  231. Cython/Plex/Transitions.py +239 -0
  232. Cython/Plex/__init__.py +34 -0
  233. Cython/Runtime/__init__.py +1 -0
  234. Cython/Runtime/refnanny.pyx +261 -0
  235. Cython/Shadow.py +656 -0
  236. Cython/Shadow.pyi +521 -0
  237. Cython/StringIOTree.py +170 -0
  238. Cython/Tempita/__init__.py +4 -0
  239. Cython/Tempita/_looper.py +154 -0
  240. Cython/Tempita/_tempita.py +1091 -0
  241. Cython/TestUtils.py +417 -0
  242. Cython/Tests/TestCodeWriter.py +128 -0
  243. Cython/Tests/TestCythonUtils.py +202 -0
  244. Cython/Tests/TestJediTyper.py +223 -0
  245. Cython/Tests/TestShadow.py +114 -0
  246. Cython/Tests/TestStringIOTree.py +67 -0
  247. Cython/Tests/TestTestUtils.py +90 -0
  248. Cython/Tests/__init__.py +1 -0
  249. Cython/Tests/xmlrunner.py +390 -0
  250. Cython/Utility/AsyncGen.c +1263 -0
  251. Cython/Utility/Buffer.c +875 -0
  252. Cython/Utility/Builtins.c +660 -0
  253. Cython/Utility/CConvert.pyx +134 -0
  254. Cython/Utility/CMath.c +95 -0
  255. Cython/Utility/CommonStructures.c +139 -0
  256. Cython/Utility/Complex.c +378 -0
  257. Cython/Utility/Coroutine.c +2413 -0
  258. Cython/Utility/CpdefEnums.pyx +108 -0
  259. Cython/Utility/CppConvert.pyx +279 -0
  260. Cython/Utility/CppSupport.cpp +133 -0
  261. Cython/Utility/CythonFunction.c +1851 -0
  262. Cython/Utility/Dataclasses.c +185 -0
  263. Cython/Utility/Dataclasses.py +112 -0
  264. Cython/Utility/Embed.c +125 -0
  265. Cython/Utility/Exceptions.c +1017 -0
  266. Cython/Utility/ExtensionTypes.c +797 -0
  267. Cython/Utility/FunctionArguments.c +573 -0
  268. Cython/Utility/ImportExport.c +912 -0
  269. Cython/Utility/MemoryView.pyx +1478 -0
  270. Cython/Utility/MemoryView_C.c +992 -0
  271. Cython/Utility/ModuleSetupCode.c +2501 -0
  272. Cython/Utility/NumpyImportArray.c +46 -0
  273. Cython/Utility/ObjectHandling.c +3054 -0
  274. Cython/Utility/Optimize.c +1533 -0
  275. Cython/Utility/Overflow.c +404 -0
  276. Cython/Utility/Printing.c +86 -0
  277. Cython/Utility/Profile.c +660 -0
  278. Cython/Utility/StringTools.c +1206 -0
  279. Cython/Utility/TestCyUtilityLoader.pyx +8 -0
  280. Cython/Utility/TestCythonScope.pyx +75 -0
  281. Cython/Utility/TestUtilityLoader.c +12 -0
  282. Cython/Utility/TypeConversion.c +1329 -0
  283. Cython/Utility/UFuncs.pyx +50 -0
  284. Cython/Utility/UFuncs_C.c +89 -0
  285. Cython/Utility/__init__.py +28 -0
  286. Cython/Utility/arrayarray.h +143 -0
  287. Cython/Utils.py +687 -0
  288. Cython/__init__.py +10 -0
  289. Cython/__init__.pyi +7 -0
  290. Cython/py.typed +0 -0
  291. Cython-3.1.0a1.dist-info/COPYING.txt +19 -0
  292. Cython-3.1.0a1.dist-info/LICENSE.txt +176 -0
  293. Cython-3.1.0a1.dist-info/METADATA +67 -0
  294. Cython-3.1.0a1.dist-info/RECORD +301 -0
  295. Cython-3.1.0a1.dist-info/WHEEL +5 -0
  296. Cython-3.1.0a1.dist-info/entry_points.txt +4 -0
  297. Cython-3.1.0a1.dist-info/top_level.txt +3 -0
  298. cython.py +29 -0
  299. pyximport/__init__.py +4 -0
  300. pyximport/pyxbuild.py +160 -0
  301. pyximport/pyximport.py +482 -0
@@ -0,0 +1,1263 @@
1
+ // This is copied from genobject.c in CPython 3.6.
2
+ // Try to keep it in sync by doing this from time to time:
3
+ // sed -e 's|__pyx_||ig' Cython/Utility/AsyncGen.c | diff -udw - cpython/Objects/genobject.c | less
4
+
5
+ //////////////////// AsyncGenerator.module_state_decls ////////////////////
6
+
7
+ PyTypeObject *__pyx__PyAsyncGenWrappedValueType;
8
+ PyTypeObject *__pyx__PyAsyncGenASendType;
9
+ PyTypeObject *__pyx__PyAsyncGenAThrowType;
10
+ PyTypeObject *__pyx_AsyncGenType;
11
+
12
+ // Freelists boost performance 6-10%; they also reduce memory
13
+ // fragmentation, as _PyAsyncGenWrappedValue and PyAsyncGenASend
14
+ // are short-living objects that are instantiated for every
15
+ // __anext__ call.
16
+
17
+ #if CYTHON_USE_FREELISTS
18
+ struct __pyx__PyAsyncGenWrappedValue *__Pyx_ag_value_freelist[_PyAsyncGen_MAXFREELIST];
19
+ int __Pyx_ag_value_freelist_free;
20
+
21
+ struct __pyx_PyAsyncGenASend *__Pyx_ag_asend_freelist[_PyAsyncGen_MAXFREELIST];
22
+ int __Pyx_ag_asend_freelist_free;
23
+ #endif
24
+
25
+ //////////////////// AsyncGenerator.proto ////////////////////
26
+ //@requires: Coroutine.c::Coroutine
27
+
28
+ #define __Pyx_AsyncGen_USED
29
+ typedef struct {
30
+ __pyx_CoroutineObject coro;
31
+ PyObject *ag_finalizer;
32
+ int ag_hooks_inited;
33
+ int ag_closed;
34
+ int ag_running_async;
35
+ } __pyx_PyAsyncGenObject;
36
+
37
+ #define __Pyx_AsyncGen_CheckExact(obj) __Pyx_IS_TYPE(obj, CGLOBAL(__pyx_AsyncGenType))
38
+ #define __pyx_PyAsyncGenASend_CheckExact(o) \
39
+ __Pyx_IS_TYPE(o, CGLOBAL(__pyx__PyAsyncGenASendType))
40
+ #define __pyx_PyAsyncGenAThrow_CheckExact(o) \
41
+ __Pyx_IS_TYPE(o, CGLOBAL(__pyx__PyAsyncGenAThrowType))
42
+
43
+ static PyObject *__Pyx_async_gen_anext(PyObject *o);
44
+ static CYTHON_INLINE PyObject *__Pyx_async_gen_asend_iternext(PyObject *o);
45
+ static PyObject *__Pyx_async_gen_asend_send(PyObject *g, PyObject *arg);
46
+ static PyObject *__Pyx_async_gen_asend_close(PyObject *o, PyObject *args);
47
+ static PyObject *__Pyx_async_gen_athrow_close(PyObject *o, PyObject *args);
48
+
49
+ static PyObject *__Pyx__PyAsyncGenValueWrapperNew(PyObject *val);
50
+
51
+
52
+ static __pyx_CoroutineObject *__Pyx_AsyncGen_New(
53
+ __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
54
+ PyObject *name, PyObject *qualname, PyObject *module_name);
55
+
56
+ static int __pyx_AsyncGen_init(PyObject *module);
57
+ static void __Pyx_PyAsyncGen_Fini(void);
58
+
59
+ #if CYTHON_USE_FREELISTS && !defined(_PyAsyncGen_MAXFREELIST)
60
+ #define _PyAsyncGen_MAXFREELIST 80
61
+ #endif
62
+
63
+ struct __pyx__PyAsyncGenWrappedValue;
64
+ struct __pyx_PyAsyncGenASend;
65
+
66
+ //////////////////// AsyncGenerator.cleanup ////////////////////
67
+
68
+ __Pyx_PyAsyncGen_Fini();
69
+
70
+ //////////////////// AsyncGenerator ////////////////////
71
+ //@substitute: naming
72
+ //@requires: Coroutine.c::Coroutine
73
+ //@requires: Coroutine.c::ReturnWithStopIteration
74
+ //@requires: ObjectHandling.c::PyObjectCall2Args
75
+ //@requires: ExtensionTypes.c::CallTypeTraverse
76
+
77
+ PyDoc_STRVAR(__Pyx_async_gen_send_doc,
78
+ "send(arg) -> send 'arg' into generator,\n\
79
+ return next yielded value or raise StopIteration.");
80
+
81
+ PyDoc_STRVAR(__Pyx_async_gen_close_doc,
82
+ "close() -> raise GeneratorExit inside generator.");
83
+
84
+ PyDoc_STRVAR(__Pyx_async_gen_throw_doc,
85
+ "throw(typ[,val[,tb]]) -> raise exception in generator,\n\
86
+ return next yielded value or raise StopIteration.");
87
+
88
+ PyDoc_STRVAR(__Pyx_async_gen_await_doc,
89
+ "__await__() -> return a representation that can be passed into the 'await' expression.");
90
+
91
+ static __pyx_CoroutineObject *__Pyx_AsyncGen_New(
92
+ __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
93
+ PyObject *name, PyObject *qualname, PyObject *module_name) {
94
+ __pyx_PyAsyncGenObject *gen = PyObject_GC_New(__pyx_PyAsyncGenObject, CGLOBAL(__pyx_AsyncGenType));
95
+ if (unlikely(!gen))
96
+ return NULL;
97
+ gen->ag_finalizer = NULL;
98
+ gen->ag_closed = 0;
99
+ gen->ag_hooks_inited = 0;
100
+ gen->ag_running_async = 0;
101
+ return __Pyx__Coroutine_NewInit((__pyx_CoroutineObject*)gen, body, code, closure, name, qualname, module_name);
102
+ }
103
+
104
+ // COPY STARTS HERE:
105
+
106
+ static PyObject *__Pyx_async_gen_asend_new(__pyx_PyAsyncGenObject *, PyObject *);
107
+ static PyObject *__Pyx_async_gen_athrow_new(__pyx_PyAsyncGenObject *, PyObject *);
108
+
109
+ static const char *__Pyx_NON_INIT_CORO_MSG = "can't send non-None value to a just-started coroutine";
110
+ static const char *__Pyx_ASYNC_GEN_IGNORED_EXIT_MSG = "async generator ignored GeneratorExit";
111
+ static const char *__Pyx_ASYNC_GEN_CANNOT_REUSE_SEND_MSG = "cannot reuse already awaited __anext__()/asend()";
112
+ static const char *__Pyx_ASYNC_GEN_CANNOT_REUSE_CLOSE_MSG = "cannot reuse already awaited aclose()/athrow()";
113
+
114
+ typedef enum {
115
+ __PYX_AWAITABLE_STATE_INIT, /* new awaitable, has not yet been iterated */
116
+ __PYX_AWAITABLE_STATE_ITER, /* being iterated */
117
+ __PYX_AWAITABLE_STATE_CLOSED, /* closed */
118
+ } __pyx_AwaitableState;
119
+
120
+ typedef struct __pyx_PyAsyncGenASend {
121
+ PyObject_HEAD
122
+ __pyx_PyAsyncGenObject *ags_gen;
123
+
124
+ /* Can be NULL, when in the __anext__() mode (equivalent of "asend(None)") */
125
+ PyObject *ags_sendval;
126
+
127
+ __pyx_AwaitableState ags_state;
128
+ } __pyx_PyAsyncGenASend;
129
+
130
+
131
+ typedef struct {
132
+ PyObject_HEAD
133
+ __pyx_PyAsyncGenObject *agt_gen;
134
+
135
+ /* Can be NULL, when in the "aclose()" mode (equivalent of "athrow(GeneratorExit)") */
136
+ PyObject *agt_args;
137
+
138
+ __pyx_AwaitableState agt_state;
139
+ } __pyx_PyAsyncGenAThrow;
140
+
141
+
142
+ typedef struct __pyx__PyAsyncGenWrappedValue {
143
+ PyObject_HEAD
144
+ PyObject *agw_val;
145
+ } __pyx__PyAsyncGenWrappedValue;
146
+
147
+ #define __pyx__PyAsyncGenWrappedValue_CheckExact(o) \
148
+ __Pyx_IS_TYPE(o, CGLOBAL(__pyx__PyAsyncGenWrappedValueType))
149
+
150
+
151
+ static int
152
+ __Pyx_async_gen_traverse(__pyx_PyAsyncGenObject *gen, visitproc visit, void *arg)
153
+ {
154
+ // visiting the type is handled in the base if needed
155
+ Py_VISIT(gen->ag_finalizer);
156
+ return __Pyx_Coroutine_traverse((__pyx_CoroutineObject*)gen, visit, arg);
157
+ }
158
+
159
+
160
+ static PyObject *
161
+ __Pyx_async_gen_repr(__pyx_CoroutineObject *o)
162
+ {
163
+ // avoid NULL pointer dereference for qualname during garbage collection
164
+ return PyUnicode_FromFormat("<async_generator object %S at %p>",
165
+ o->gi_qualname ? o->gi_qualname : Py_None, o);
166
+ }
167
+
168
+
169
+ static int
170
+ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o)
171
+ {
172
+ #if !CYTHON_COMPILING_IN_PYPY
173
+ PyThreadState *tstate;
174
+ #endif
175
+ PyObject *finalizer;
176
+ PyObject *firstiter;
177
+
178
+ if (o->ag_hooks_inited) {
179
+ return 0;
180
+ }
181
+
182
+ o->ag_hooks_inited = 1;
183
+
184
+ #if CYTHON_COMPILING_IN_PYPY
185
+ finalizer = _PyEval_GetAsyncGenFinalizer();
186
+ #else
187
+ tstate = __Pyx_PyThreadState_Current;
188
+ finalizer = tstate->async_gen_finalizer;
189
+ #endif
190
+ if (finalizer) {
191
+ Py_INCREF(finalizer);
192
+ o->ag_finalizer = finalizer;
193
+ }
194
+
195
+ #if CYTHON_COMPILING_IN_PYPY
196
+ firstiter = _PyEval_GetAsyncGenFirstiter();
197
+ #else
198
+ firstiter = tstate->async_gen_firstiter;
199
+ #endif
200
+ if (firstiter) {
201
+ PyObject *res;
202
+ #if CYTHON_UNPACK_METHODS
203
+ PyObject *self;
204
+ #endif
205
+
206
+ Py_INCREF(firstiter);
207
+ // at least asyncio stores methods here => optimise the call
208
+ #if CYTHON_UNPACK_METHODS
209
+ if (likely(PyMethod_Check(firstiter)) && likely((self = PyMethod_GET_SELF(firstiter)) != NULL)) {
210
+ PyObject *function = PyMethod_GET_FUNCTION(firstiter);
211
+ res = __Pyx_PyObject_Call2Args(function, self, (PyObject*)o);
212
+ } else
213
+ #endif
214
+ res = __Pyx_PyObject_CallOneArg(firstiter, (PyObject*)o);
215
+
216
+ Py_DECREF(firstiter);
217
+ if (unlikely(res == NULL)) {
218
+ return 1;
219
+ }
220
+ Py_DECREF(res);
221
+ }
222
+
223
+ return 0;
224
+ }
225
+
226
+
227
+ static PyObject *
228
+ __Pyx_async_gen_anext(PyObject *g)
229
+ {
230
+ __pyx_PyAsyncGenObject *o = (__pyx_PyAsyncGenObject*) g;
231
+ if (unlikely(__Pyx_async_gen_init_hooks(o))) {
232
+ return NULL;
233
+ }
234
+ return __Pyx_async_gen_asend_new(o, NULL);
235
+ }
236
+
237
+ static PyObject *
238
+ __Pyx_async_gen_anext_method(PyObject *g, PyObject *arg) {
239
+ CYTHON_UNUSED_VAR(arg);
240
+ return __Pyx_async_gen_anext(g);
241
+ }
242
+
243
+
244
+ static PyObject *
245
+ __Pyx_async_gen_asend(__pyx_PyAsyncGenObject *o, PyObject *arg)
246
+ {
247
+ if (unlikely(__Pyx_async_gen_init_hooks(o))) {
248
+ return NULL;
249
+ }
250
+ return __Pyx_async_gen_asend_new(o, arg);
251
+ }
252
+
253
+
254
+ static PyObject *
255
+ __Pyx_async_gen_aclose(__pyx_PyAsyncGenObject *o, PyObject *arg)
256
+ {
257
+ CYTHON_UNUSED_VAR(arg);
258
+ if (unlikely(__Pyx_async_gen_init_hooks(o))) {
259
+ return NULL;
260
+ }
261
+ return __Pyx_async_gen_athrow_new(o, NULL);
262
+ }
263
+
264
+
265
+ static PyObject *
266
+ __Pyx_async_gen_athrow(__pyx_PyAsyncGenObject *o, PyObject *args)
267
+ {
268
+ if (unlikely(__Pyx_async_gen_init_hooks(o))) {
269
+ return NULL;
270
+ }
271
+ return __Pyx_async_gen_athrow_new(o, args);
272
+ }
273
+
274
+
275
+ static PyObject *
276
+ __Pyx_async_gen_self_method(PyObject *g, PyObject *arg) {
277
+ CYTHON_UNUSED_VAR(arg);
278
+ return __Pyx_NewRef(g);
279
+ }
280
+
281
+
282
+ static PyGetSetDef __Pyx_async_gen_getsetlist[] = {
283
+ {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
284
+ PyDoc_STR("name of the async generator"), 0},
285
+ {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
286
+ PyDoc_STR("qualified name of the async generator"), 0},
287
+ //REMOVED: {(char*) "ag_await", (getter)coro_get_cr_await, NULL,
288
+ //REMOVED: (char*) PyDoc_STR("object being awaited on, or None")},
289
+ {0, 0, 0, 0, 0} /* Sentinel */
290
+ };
291
+
292
+ static PyMemberDef __Pyx_async_gen_memberlist[] = {
293
+ //REMOVED: {(char*) "ag_frame", T_OBJECT, offsetof(__pyx_PyAsyncGenObject, ag_frame), READONLY},
294
+ {"ag_running", T_BOOL, offsetof(__pyx_PyAsyncGenObject, ag_running_async), READONLY, NULL},
295
+ //REMOVED: {(char*) "ag_code", T_OBJECT, offsetof(__pyx_PyAsyncGenObject, ag_code), READONLY},
296
+ //ADDED: "ag_await"
297
+ {"ag_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
298
+ PyDoc_STR("object being awaited on, or None")},
299
+ {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
300
+ #if CYTHON_USE_TYPE_SPECS
301
+ {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
302
+ #endif
303
+ {0, 0, 0, 0, 0} /* Sentinel */
304
+ };
305
+
306
+ PyDoc_STRVAR(__Pyx_async_aclose_doc,
307
+ "aclose() -> raise GeneratorExit inside generator.");
308
+
309
+ PyDoc_STRVAR(__Pyx_async_asend_doc,
310
+ "asend(v) -> send 'v' in generator.");
311
+
312
+ PyDoc_STRVAR(__Pyx_async_athrow_doc,
313
+ "athrow(typ[,val[,tb]]) -> raise exception in generator.");
314
+
315
+ PyDoc_STRVAR(__Pyx_async_aiter_doc,
316
+ "__aiter__(v) -> return an asynchronous iterator.");
317
+
318
+ PyDoc_STRVAR(__Pyx_async_anext_doc,
319
+ "__anext__(v) -> continue asynchronous iteration and return the next element.");
320
+
321
+ static PyMethodDef __Pyx_async_gen_methods[] = {
322
+ {"asend", (PyCFunction)__Pyx_async_gen_asend, METH_O, __Pyx_async_asend_doc},
323
+ {"athrow",(PyCFunction)__Pyx_async_gen_athrow, METH_VARARGS, __Pyx_async_athrow_doc},
324
+ {"aclose", (PyCFunction)__Pyx_async_gen_aclose, METH_NOARGS, __Pyx_async_aclose_doc},
325
+ {"__aiter__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_aiter_doc},
326
+ {"__anext__", (PyCFunction)__Pyx_async_gen_anext_method, METH_NOARGS, __Pyx_async_anext_doc},
327
+ {0, 0, 0, 0} /* Sentinel */
328
+ };
329
+
330
+
331
+ #if CYTHON_USE_TYPE_SPECS
332
+ static PyType_Slot __pyx_AsyncGenType_slots[] = {
333
+ {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
334
+ {Py_am_aiter, (void *)PyObject_SelfIter},
335
+ {Py_am_anext, (void *)__Pyx_async_gen_anext},
336
+ {Py_tp_repr, (void *)__Pyx_async_gen_repr},
337
+ {Py_tp_traverse, (void *)__Pyx_async_gen_traverse},
338
+ {Py_tp_methods, (void *)__Pyx_async_gen_methods},
339
+ {Py_tp_members, (void *)__Pyx_async_gen_memberlist},
340
+ {Py_tp_getset, (void *)__Pyx_async_gen_getsetlist},
341
+ #if CYTHON_USE_TP_FINALIZE
342
+ {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
343
+ #endif
344
+ {0, 0},
345
+ };
346
+
347
+ static PyType_Spec __pyx_AsyncGenType_spec = {
348
+ __PYX_TYPE_MODULE_PREFIX "async_generator",
349
+ sizeof(__pyx_PyAsyncGenObject),
350
+ 0,
351
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
352
+ __pyx_AsyncGenType_slots
353
+ };
354
+ #else /* CYTHON_USE_TYPE_SPECS */
355
+
356
+ static __Pyx_PyAsyncMethodsStruct __Pyx_async_gen_as_async = {
357
+ 0, /* am_await */
358
+ PyObject_SelfIter, /* am_aiter */
359
+ (unaryfunc)__Pyx_async_gen_anext, /* am_anext */
360
+ 0, /* am_send */
361
+ };
362
+
363
+ static PyTypeObject __pyx_AsyncGenType_type = {
364
+ PyVarObject_HEAD_INIT(0, 0)
365
+ "async_generator", /* tp_name */
366
+ sizeof(__pyx_PyAsyncGenObject), /* tp_basicsize */
367
+ 0, /* tp_itemsize */
368
+ (destructor)__Pyx_Coroutine_dealloc, /* tp_dealloc */
369
+ 0, /* tp_vectorcall_offset */
370
+ 0, /* tp_getattr */
371
+ 0, /* tp_setattr */
372
+ __Pyx_SlotTpAsAsync(__Pyx_async_gen_as_async), /* tp_as_async */
373
+ (reprfunc)__Pyx_async_gen_repr, /* tp_repr */
374
+ 0, /* tp_as_number */
375
+ 0, /* tp_as_sequence */
376
+ 0, /* tp_as_mapping */
377
+ 0, /* tp_hash */
378
+ 0, /* tp_call */
379
+ 0, /* tp_str */
380
+ 0, /* tp_getattro */
381
+ 0, /* tp_setattro */
382
+ 0, /* tp_as_buffer */
383
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
384
+ Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags */
385
+ 0, /* tp_doc */
386
+ (traverseproc)__Pyx_async_gen_traverse, /* tp_traverse */
387
+ 0, /* tp_clear */
388
+ 0, /*tp_richcompare*/
389
+ offsetof(__pyx_CoroutineObject, gi_weakreflist), /* tp_weaklistoffset */
390
+ 0, /* tp_iter */
391
+ 0, /* tp_iternext */
392
+ __Pyx_async_gen_methods, /* tp_methods */
393
+ __Pyx_async_gen_memberlist, /* tp_members */
394
+ __Pyx_async_gen_getsetlist, /* tp_getset */
395
+ 0, /* tp_base */
396
+ 0, /* tp_dict */
397
+ 0, /* tp_descr_get */
398
+ 0, /* tp_descr_set */
399
+ 0, /* tp_dictoffset */
400
+ 0, /* tp_init */
401
+ 0, /* tp_alloc */
402
+ 0, /* tp_new */
403
+ 0, /* tp_free */
404
+ 0, /* tp_is_gc */
405
+ 0, /* tp_bases */
406
+ 0, /* tp_mro */
407
+ 0, /* tp_cache */
408
+ 0, /* tp_subclasses */
409
+ 0, /* tp_weaklist */
410
+ #if CYTHON_USE_TP_FINALIZE
411
+ 0, /*tp_del*/
412
+ #else
413
+ __Pyx_Coroutine_del, /*tp_del*/
414
+ #endif
415
+ 0, /* tp_version_tag */
416
+ #if CYTHON_USE_TP_FINALIZE
417
+ __Pyx_Coroutine_del, /* tp_finalize */
418
+ #else
419
+ 0, /* tp_finalize */
420
+ #endif
421
+ #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
422
+ 0, /*tp_vectorcall*/
423
+ #endif
424
+ #if __PYX_NEED_TP_PRINT_SLOT
425
+ 0, /*tp_print*/
426
+ #endif
427
+ #if PY_VERSION_HEX >= 0x030C0000
428
+ 0, /*tp_watched*/
429
+ #endif
430
+ #if PY_VERSION_HEX >= 0x030d00A4
431
+ 0, /*tp_versions_used*/
432
+ #endif
433
+ #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
434
+ 0, /*tp_pypy_flags*/
435
+ #endif
436
+ };
437
+ #endif /* CYTHON_USE_TYPE_SPECS */
438
+
439
+
440
+ static int
441
+ __Pyx_PyAsyncGen_ClearFreeLists(void)
442
+ {
443
+ #if CYTHON_USE_FREELISTS
444
+ int ret = CGLOBAL(__Pyx_ag_value_freelist_free) + CGLOBAL(__Pyx_ag_asend_freelist_free);
445
+
446
+ while (CGLOBAL(__Pyx_ag_value_freelist_free)) {
447
+ __pyx__PyAsyncGenWrappedValue *o;
448
+ o = CGLOBAL(__Pyx_ag_value_freelist)[--CGLOBAL(__Pyx_ag_value_freelist_free]);
449
+ assert(__pyx__PyAsyncGenWrappedValue_CheckExact(o));
450
+ __Pyx_PyHeapTypeObject_GC_Del(o);
451
+ }
452
+
453
+ while (CGLOBAL(__Pyx_ag_asend_freelist_free)) {
454
+ __pyx_PyAsyncGenASend *o;
455
+ o = CGLOBAL(__Pyx_ag_asend_freelist)[--CGLOBAL(__Pyx_ag_asend_freelist_free)];
456
+ assert(__Pyx_IS_TYPE(o, CGLOBAL(__pyx__PyAsyncGenASendType)));
457
+ __Pyx_PyHeapTypeObject_GC_Del(o);
458
+ }
459
+
460
+ return ret;
461
+ #else
462
+ return 0;
463
+ #endif
464
+ }
465
+
466
+ static void
467
+ __Pyx_PyAsyncGen_Fini(void)
468
+ {
469
+ __Pyx_PyAsyncGen_ClearFreeLists();
470
+ }
471
+
472
+
473
+ static PyObject *
474
+ __Pyx_async_gen_unwrap_value(__pyx_PyAsyncGenObject *gen, PyObject *result)
475
+ {
476
+ if (result == NULL) {
477
+ PyObject *exc_type = PyErr_Occurred();
478
+ if (!exc_type) {
479
+ PyErr_SetNone(PyExc_StopAsyncIteration);
480
+ gen->ag_closed = 1;
481
+ } else if (__Pyx_PyErr_GivenExceptionMatches2(exc_type, PyExc_StopAsyncIteration, PyExc_GeneratorExit)) {
482
+ gen->ag_closed = 1;
483
+ }
484
+
485
+ gen->ag_running_async = 0;
486
+ return NULL;
487
+ }
488
+
489
+ if (__pyx__PyAsyncGenWrappedValue_CheckExact(result)) {
490
+ /* async yield */
491
+ __Pyx_ReturnWithStopIteration(((__pyx__PyAsyncGenWrappedValue*)result)->agw_val, 0);
492
+ Py_DECREF(result);
493
+ gen->ag_running_async = 0;
494
+ return NULL;
495
+ }
496
+
497
+ return result;
498
+ }
499
+
500
+
501
+ /* ---------- Async Generator ASend Awaitable ------------ */
502
+
503
+
504
+ static void
505
+ __Pyx_async_gen_asend_dealloc(__pyx_PyAsyncGenASend *o)
506
+ {
507
+ PyObject_GC_UnTrack((PyObject *)o);
508
+ Py_CLEAR(o->ags_gen);
509
+ Py_CLEAR(o->ags_sendval);
510
+ #if CYTHON_USE_FREELISTS
511
+ if (likely(CGLOBAL(__Pyx_ag_asend_freelist_free) < _PyAsyncGen_MAXFREELIST)) {
512
+ assert(__pyx_PyAsyncGenASend_CheckExact(o));
513
+ CGLOBAL(__Pyx_ag_asend_freelist)[CGLOBAL(__Pyx_ag_asend_freelist_free)++] = o;
514
+ } else
515
+ #endif
516
+ {
517
+ __Pyx_PyHeapTypeObject_GC_Del(o);
518
+ }
519
+ }
520
+
521
+ static int
522
+ __Pyx_async_gen_asend_traverse(__pyx_PyAsyncGenASend *o, visitproc visit, void *arg)
523
+ {
524
+ {
525
+ int e = __Pyx_call_type_traverse((PyObject*)o, 1, visit, arg);
526
+ if (e) return e;
527
+ }
528
+ Py_VISIT(o->ags_gen);
529
+ Py_VISIT(o->ags_sendval);
530
+ return 0;
531
+ }
532
+
533
+
534
+ static PyObject *
535
+ __Pyx_async_gen_asend_send(PyObject *g, PyObject *arg)
536
+ {
537
+ __pyx_PyAsyncGenASend *o = (__pyx_PyAsyncGenASend*) g;
538
+ PyObject *retval;
539
+
540
+ if (unlikely(o->ags_state == __PYX_AWAITABLE_STATE_CLOSED)) {
541
+ PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_CANNOT_REUSE_SEND_MSG);
542
+ return NULL;
543
+ }
544
+
545
+ if (o->ags_state == __PYX_AWAITABLE_STATE_INIT) {
546
+ if (unlikely(o->ags_gen->ag_running_async)) {
547
+ PyErr_SetString(
548
+ PyExc_RuntimeError,
549
+ "anext(): asynchronous generator is already running");
550
+ return NULL;
551
+ }
552
+
553
+ if (arg == NULL || arg == Py_None) {
554
+ arg = o->ags_sendval ? o->ags_sendval : Py_None;
555
+ }
556
+ o->ags_state = __PYX_AWAITABLE_STATE_ITER;
557
+ }
558
+
559
+ o->ags_gen->ag_running_async = 1;
560
+ retval = __Pyx_Coroutine_Send((PyObject*)o->ags_gen, arg);
561
+ retval = __Pyx_async_gen_unwrap_value(o->ags_gen, retval);
562
+
563
+ if (!retval) {
564
+ o->ags_state = __PYX_AWAITABLE_STATE_CLOSED;
565
+ }
566
+
567
+ return retval;
568
+ }
569
+
570
+
571
+ static CYTHON_INLINE PyObject *
572
+ __Pyx_async_gen_asend_iternext(PyObject *o)
573
+ {
574
+ return __Pyx_async_gen_asend_send(o, Py_None);
575
+ }
576
+
577
+
578
+ static PyObject *
579
+ __Pyx_async_gen_asend_throw(__pyx_PyAsyncGenASend *o, PyObject *args)
580
+ {
581
+ PyObject *result;
582
+
583
+ if (unlikely(o->ags_state == __PYX_AWAITABLE_STATE_CLOSED)) {
584
+ PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_CANNOT_REUSE_SEND_MSG);
585
+ return NULL;
586
+ }
587
+
588
+ result = __Pyx_Coroutine_Throw((PyObject*)o->ags_gen, args);
589
+ result = __Pyx_async_gen_unwrap_value(o->ags_gen, result);
590
+
591
+ if (result == NULL) {
592
+ o->ags_state = __PYX_AWAITABLE_STATE_CLOSED;
593
+ }
594
+
595
+ return result;
596
+ }
597
+
598
+
599
+ static PyObject *
600
+ __Pyx_async_gen_asend_close(PyObject *g, PyObject *args)
601
+ {
602
+ __pyx_PyAsyncGenASend *o = (__pyx_PyAsyncGenASend*) g;
603
+ CYTHON_UNUSED_VAR(args);
604
+ o->ags_state = __PYX_AWAITABLE_STATE_CLOSED;
605
+ Py_RETURN_NONE;
606
+ }
607
+
608
+
609
+ static PyMethodDef __Pyx_async_gen_asend_methods[] = {
610
+ {"send", (PyCFunction)__Pyx_async_gen_asend_send, METH_O, __Pyx_async_gen_send_doc},
611
+ {"throw", (PyCFunction)__Pyx_async_gen_asend_throw, METH_VARARGS, __Pyx_async_gen_throw_doc},
612
+ {"close", (PyCFunction)__Pyx_async_gen_asend_close, METH_NOARGS, __Pyx_async_gen_close_doc},
613
+ {"__await__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_gen_await_doc},
614
+ {0, 0, 0, 0} /* Sentinel */
615
+ };
616
+
617
+
618
+ #if CYTHON_USE_TYPE_SPECS
619
+ static PyType_Slot __pyx__PyAsyncGenASendType_slots[] = {
620
+ {Py_tp_dealloc, (void *)__Pyx_async_gen_asend_dealloc},
621
+ {Py_am_await, (void *)PyObject_SelfIter},
622
+ {Py_tp_traverse, (void *)__Pyx_async_gen_asend_traverse},
623
+ {Py_tp_methods, (void *)__Pyx_async_gen_asend_methods},
624
+ {Py_tp_iter, (void *)PyObject_SelfIter},
625
+ {Py_tp_iternext, (void *)__Pyx_async_gen_asend_iternext},
626
+ {0, 0},
627
+ };
628
+
629
+ static PyType_Spec __pyx__PyAsyncGenASendType_spec = {
630
+ __PYX_TYPE_MODULE_PREFIX "async_generator_asend",
631
+ sizeof(__pyx_PyAsyncGenASend),
632
+ 0,
633
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
634
+ __pyx__PyAsyncGenASendType_slots
635
+ };
636
+ #else /* CYTHON_USE_TYPE_SPECS */
637
+
638
+ static __Pyx_PyAsyncMethodsStruct __Pyx_async_gen_asend_as_async = {
639
+ PyObject_SelfIter, /* am_await */
640
+ 0, /* am_aiter */
641
+ 0, /* am_anext */
642
+ 0, /* am_send */
643
+ };
644
+
645
+ static PyTypeObject __pyx__PyAsyncGenASendType_type = {
646
+ PyVarObject_HEAD_INIT(0, 0)
647
+ "async_generator_asend", /* tp_name */
648
+ sizeof(__pyx_PyAsyncGenASend), /* tp_basicsize */
649
+ 0, /* tp_itemsize */
650
+ /* methods */
651
+ (destructor)__Pyx_async_gen_asend_dealloc, /* tp_dealloc */
652
+ 0, /* tp_vectorcall_offset */
653
+ 0, /* tp_getattr */
654
+ 0, /* tp_setattr */
655
+ __Pyx_SlotTpAsAsync(__Pyx_async_gen_asend_as_async), /* tp_as_async */
656
+ 0, /* tp_repr */
657
+ 0, /* tp_as_number */
658
+ 0, /* tp_as_sequence */
659
+ 0, /* tp_as_mapping */
660
+ 0, /* tp_hash */
661
+ 0, /* tp_call */
662
+ 0, /* tp_str */
663
+ 0, /* tp_getattro */
664
+ 0, /* tp_setattro */
665
+ 0, /* tp_as_buffer */
666
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
667
+ 0, /* tp_doc */
668
+ (traverseproc)__Pyx_async_gen_asend_traverse, /* tp_traverse */
669
+ 0, /* tp_clear */
670
+ 0, /*tp_richcompare*/
671
+ 0, /* tp_weaklistoffset */
672
+ PyObject_SelfIter, /* tp_iter */
673
+ (iternextfunc)__Pyx_async_gen_asend_iternext, /* tp_iternext */
674
+ __Pyx_async_gen_asend_methods, /* tp_methods */
675
+ 0, /* tp_members */
676
+ 0, /* tp_getset */
677
+ 0, /* tp_base */
678
+ 0, /* tp_dict */
679
+ 0, /* tp_descr_get */
680
+ 0, /* tp_descr_set */
681
+ 0, /* tp_dictoffset */
682
+ 0, /* tp_init */
683
+ 0, /* tp_alloc */
684
+ 0, /* tp_new */
685
+ 0, /* tp_free */
686
+ 0, /* tp_is_gc */
687
+ 0, /* tp_bases */
688
+ 0, /* tp_mro */
689
+ 0, /* tp_cache */
690
+ 0, /* tp_subclasses */
691
+ 0, /* tp_weaklist */
692
+ 0, /* tp_del */
693
+ 0, /* tp_version_tag */
694
+ 0, /* tp_finalize */
695
+ #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
696
+ 0, /*tp_vectorcall*/
697
+ #endif
698
+ #if __PYX_NEED_TP_PRINT_SLOT
699
+ 0, /*tp_print*/
700
+ #endif
701
+ #if PY_VERSION_HEX >= 0x030C0000
702
+ 0, /*tp_watched*/
703
+ #endif
704
+ #if PY_VERSION_HEX >= 0x030d00A4
705
+ 0, /*tp_versions_used*/
706
+ #endif
707
+ #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
708
+ 0, /*tp_pypy_flags*/
709
+ #endif
710
+ };
711
+ #endif /* CYTHON_USE_TYPE_SPECS */
712
+
713
+
714
+ static PyObject *
715
+ __Pyx_async_gen_asend_new(__pyx_PyAsyncGenObject *gen, PyObject *sendval)
716
+ {
717
+ __pyx_PyAsyncGenASend *o;
718
+ #if CYTHON_USE_FREELISTS
719
+ if (likely(CGLOBAL(__Pyx_ag_asend_freelist_free))) {
720
+ CGLOBAL(__Pyx_ag_asend_freelist_free)--;
721
+ o = CGLOBAL(__Pyx_ag_asend_freelist)[CGLOBAL(__Pyx_ag_asend_freelist_free)];
722
+ _Py_NewReference((PyObject *)o);
723
+ } else
724
+ #endif
725
+ {
726
+ o = PyObject_GC_New(__pyx_PyAsyncGenASend, CGLOBAL(__pyx__PyAsyncGenASendType));
727
+ if (unlikely(o == NULL)) {
728
+ return NULL;
729
+ }
730
+ }
731
+
732
+ Py_INCREF(gen);
733
+ o->ags_gen = gen;
734
+
735
+ Py_XINCREF(sendval);
736
+ o->ags_sendval = sendval;
737
+
738
+ o->ags_state = __PYX_AWAITABLE_STATE_INIT;
739
+
740
+ PyObject_GC_Track((PyObject*)o);
741
+ return (PyObject*)o;
742
+ }
743
+
744
+
745
+ /* ---------- Async Generator Value Wrapper ------------ */
746
+
747
+
748
+ static void
749
+ __Pyx_async_gen_wrapped_val_dealloc(__pyx__PyAsyncGenWrappedValue *o)
750
+ {
751
+ PyObject_GC_UnTrack((PyObject *)o);
752
+ Py_CLEAR(o->agw_val);
753
+ #if CYTHON_USE_FREELISTS
754
+ if (likely(CGLOBAL(__Pyx_ag_value_freelist_free) < _PyAsyncGen_MAXFREELIST)) {
755
+ assert(__pyx__PyAsyncGenWrappedValue_CheckExact(o));
756
+ CGLOBAL(__Pyx_ag_value_freelist)[CGLOBAL(__Pyx_ag_value_freelist_free)++] = o;
757
+ } else
758
+ #endif
759
+ {
760
+ __Pyx_PyHeapTypeObject_GC_Del(o);
761
+ }
762
+ }
763
+
764
+
765
+ static int
766
+ __Pyx_async_gen_wrapped_val_traverse(__pyx__PyAsyncGenWrappedValue *o,
767
+ visitproc visit, void *arg)
768
+ {
769
+ {
770
+ int e = __Pyx_call_type_traverse((PyObject*)o, 1, visit, arg);
771
+ if (e) return e;
772
+ }
773
+ Py_VISIT(o->agw_val);
774
+ return 0;
775
+ }
776
+
777
+
778
+ #if CYTHON_USE_TYPE_SPECS
779
+ static PyType_Slot __pyx__PyAsyncGenWrappedValueType_slots[] = {
780
+ {Py_tp_dealloc, (void *)__Pyx_async_gen_wrapped_val_dealloc},
781
+ {Py_tp_traverse, (void *)__Pyx_async_gen_wrapped_val_traverse},
782
+ {0, 0},
783
+ };
784
+
785
+ static PyType_Spec __pyx__PyAsyncGenWrappedValueType_spec = {
786
+ __PYX_TYPE_MODULE_PREFIX "async_generator_wrapped_value",
787
+ sizeof(__pyx__PyAsyncGenWrappedValue),
788
+ 0,
789
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
790
+ __pyx__PyAsyncGenWrappedValueType_slots
791
+ };
792
+ #else /* CYTHON_USE_TYPE_SPECS */
793
+
794
+ static PyTypeObject __pyx__PyAsyncGenWrappedValueType_type = {
795
+ PyVarObject_HEAD_INIT(0, 0)
796
+ "async_generator_wrapped_value", /* tp_name */
797
+ sizeof(__pyx__PyAsyncGenWrappedValue), /* tp_basicsize */
798
+ 0, /* tp_itemsize */
799
+ /* methods */
800
+ (destructor)__Pyx_async_gen_wrapped_val_dealloc, /* tp_dealloc */
801
+ 0, /* tp_vectorcall_offset */
802
+ 0, /* tp_getattr */
803
+ 0, /* tp_setattr */
804
+ 0, /* tp_as_async */
805
+ 0, /* tp_repr */
806
+ 0, /* tp_as_number */
807
+ 0, /* tp_as_sequence */
808
+ 0, /* tp_as_mapping */
809
+ 0, /* tp_hash */
810
+ 0, /* tp_call */
811
+ 0, /* tp_str */
812
+ 0, /* tp_getattro */
813
+ 0, /* tp_setattro */
814
+ 0, /* tp_as_buffer */
815
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
816
+ 0, /* tp_doc */
817
+ (traverseproc)__Pyx_async_gen_wrapped_val_traverse, /* tp_traverse */
818
+ 0, /* tp_clear */
819
+ 0, /* tp_richcompare */
820
+ 0, /* tp_weaklistoffset */
821
+ 0, /* tp_iter */
822
+ 0, /* tp_iternext */
823
+ 0, /* tp_methods */
824
+ 0, /* tp_members */
825
+ 0, /* tp_getset */
826
+ 0, /* tp_base */
827
+ 0, /* tp_dict */
828
+ 0, /* tp_descr_get */
829
+ 0, /* tp_descr_set */
830
+ 0, /* tp_dictoffset */
831
+ 0, /* tp_init */
832
+ 0, /* tp_alloc */
833
+ 0, /* tp_new */
834
+ 0, /* tp_free */
835
+ 0, /* tp_is_gc */
836
+ 0, /* tp_bases */
837
+ 0, /* tp_mro */
838
+ 0, /* tp_cache */
839
+ 0, /* tp_subclasses */
840
+ 0, /* tp_weaklist */
841
+ 0, /* tp_del */
842
+ 0, /* tp_version_tag */
843
+ 0, /* tp_finalize */
844
+ #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
845
+ 0, /*tp_vectorcall*/
846
+ #endif
847
+ #if __PYX_NEED_TP_PRINT_SLOT
848
+ 0, /*tp_print*/
849
+ #endif
850
+ #if PY_VERSION_HEX >= 0x030C0000
851
+ 0, /*tp_watched*/
852
+ #endif
853
+ #if PY_VERSION_HEX >= 0x030d00A4
854
+ 0, /*tp_versions_used*/
855
+ #endif
856
+ #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
857
+ 0, /*tp_pypy_flags*/
858
+ #endif
859
+ };
860
+ #endif /* CYTHON_USE_TYPE_SPECS */
861
+
862
+
863
+ static PyObject *
864
+ __Pyx__PyAsyncGenValueWrapperNew(PyObject *val)
865
+ {
866
+ // NOTE: steals a reference to val !
867
+ __pyx__PyAsyncGenWrappedValue *o;
868
+ assert(val);
869
+
870
+ #if CYTHON_USE_FREELISTS
871
+ if (likely(CGLOBAL(__Pyx_ag_value_freelist_free))) {
872
+ CGLOBAL(__Pyx_ag_value_freelist_free)--;
873
+ o = CGLOBAL(__Pyx_ag_value_freelist)[CGLOBAL(__Pyx_ag_value_freelist_free)];
874
+ assert(__pyx__PyAsyncGenWrappedValue_CheckExact(o));
875
+ _Py_NewReference((PyObject*)o);
876
+ } else
877
+ #endif
878
+ {
879
+ o = PyObject_GC_New(__pyx__PyAsyncGenWrappedValue, CGLOBAL(__pyx__PyAsyncGenWrappedValueType));
880
+ if (unlikely(!o)) {
881
+ Py_DECREF(val);
882
+ return NULL;
883
+ }
884
+ }
885
+ o->agw_val = val;
886
+ // no Py_INCREF(val) - steals reference!
887
+ PyObject_GC_Track((PyObject*)o);
888
+ return (PyObject*)o;
889
+ }
890
+
891
+
892
+ /* ---------- Async Generator AThrow awaitable ------------ */
893
+
894
+
895
+ static void
896
+ __Pyx_async_gen_athrow_dealloc(__pyx_PyAsyncGenAThrow *o)
897
+ {
898
+ PyObject_GC_UnTrack((PyObject *)o);
899
+ Py_CLEAR(o->agt_gen);
900
+ Py_CLEAR(o->agt_args);
901
+ __Pyx_PyHeapTypeObject_GC_Del(o);
902
+ }
903
+
904
+
905
+ static int
906
+ __Pyx_async_gen_athrow_traverse(__pyx_PyAsyncGenAThrow *o, visitproc visit, void *arg)
907
+ {
908
+ {
909
+ int e = __Pyx_call_type_traverse((PyObject*)o, 1, visit, arg);
910
+ if (e) return e;
911
+ }
912
+ Py_VISIT(o->agt_gen);
913
+ Py_VISIT(o->agt_args);
914
+ return 0;
915
+ }
916
+
917
+
918
+ static PyObject *
919
+ __Pyx_async_gen_athrow_send(__pyx_PyAsyncGenAThrow *o, PyObject *arg)
920
+ {
921
+ __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*)o->agt_gen;
922
+ PyObject *retval, *exc_type;
923
+
924
+ if (unlikely(o->agt_state == __PYX_AWAITABLE_STATE_CLOSED)) {
925
+ PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_CANNOT_REUSE_CLOSE_MSG);
926
+ return NULL;
927
+ }
928
+
929
+ if (unlikely(gen->resume_label == -1)) {
930
+ // already run past the end
931
+ o->agt_state = __PYX_AWAITABLE_STATE_CLOSED;
932
+ PyErr_SetNone(PyExc_StopIteration);
933
+ return NULL;
934
+ }
935
+
936
+ if (o->agt_state == __PYX_AWAITABLE_STATE_INIT) {
937
+ if (unlikely(o->agt_gen->ag_running_async)) {
938
+ o->agt_state = __PYX_AWAITABLE_STATE_CLOSED;
939
+ if (o->agt_args == NULL) {
940
+ PyErr_SetString(
941
+ PyExc_RuntimeError,
942
+ "aclose(): asynchronous generator is already running");
943
+ } else {
944
+ PyErr_SetString(
945
+ PyExc_RuntimeError,
946
+ "athrow(): asynchronous generator is already running");
947
+ }
948
+ return NULL;
949
+ }
950
+
951
+ if (unlikely(o->agt_gen->ag_closed)) {
952
+ o->agt_state = __PYX_AWAITABLE_STATE_CLOSED;
953
+ PyErr_SetNone(PyExc_StopAsyncIteration);
954
+ return NULL;
955
+ }
956
+
957
+ if (unlikely(arg != Py_None)) {
958
+ PyErr_SetString(PyExc_RuntimeError, __Pyx_NON_INIT_CORO_MSG);
959
+ return NULL;
960
+ }
961
+
962
+ o->agt_state = __PYX_AWAITABLE_STATE_ITER;
963
+ o->agt_gen->ag_running_async = 1;
964
+
965
+ if (o->agt_args == NULL) {
966
+ /* aclose() mode */
967
+ o->agt_gen->ag_closed = 1;
968
+
969
+ retval = __Pyx__Coroutine_Throw((PyObject*)gen,
970
+ /* Do not close generator when PyExc_GeneratorExit is passed */
971
+ PyExc_GeneratorExit, NULL, NULL, NULL, 0);
972
+
973
+ if (retval && __pyx__PyAsyncGenWrappedValue_CheckExact(retval)) {
974
+ Py_DECREF(retval);
975
+ goto yield_close;
976
+ }
977
+ } else {
978
+ PyObject *typ;
979
+ PyObject *tb = NULL;
980
+ PyObject *val = NULL;
981
+
982
+ if (unlikely(!PyArg_UnpackTuple(o->agt_args, "athrow", 1, 3, &typ, &val, &tb))) {
983
+ return NULL;
984
+ }
985
+
986
+ retval = __Pyx__Coroutine_Throw((PyObject*)gen,
987
+ /* Do not close generator when PyExc_GeneratorExit is passed */
988
+ typ, val, tb, o->agt_args, 0);
989
+ retval = __Pyx_async_gen_unwrap_value(o->agt_gen, retval);
990
+ }
991
+ if (retval == NULL) {
992
+ goto check_error;
993
+ }
994
+ return retval;
995
+ }
996
+
997
+ assert (o->agt_state == __PYX_AWAITABLE_STATE_ITER);
998
+
999
+ retval = __Pyx_Coroutine_Send((PyObject *)gen, arg);
1000
+ if (o->agt_args) {
1001
+ return __Pyx_async_gen_unwrap_value(o->agt_gen, retval);
1002
+ } else {
1003
+ /* aclose() mode */
1004
+ if (retval) {
1005
+ if (unlikely(__pyx__PyAsyncGenWrappedValue_CheckExact(retval))) {
1006
+ Py_DECREF(retval);
1007
+ goto yield_close;
1008
+ }
1009
+ else {
1010
+ return retval;
1011
+ }
1012
+ }
1013
+ else {
1014
+ goto check_error;
1015
+ }
1016
+ }
1017
+
1018
+ yield_close:
1019
+ o->agt_gen->ag_running_async = 0;
1020
+ o->agt_state = __PYX_AWAITABLE_STATE_CLOSED;
1021
+ PyErr_SetString(
1022
+ PyExc_RuntimeError, __Pyx_ASYNC_GEN_IGNORED_EXIT_MSG);
1023
+ return NULL;
1024
+
1025
+ check_error:
1026
+ o->agt_gen->ag_running_async = 0;
1027
+ o->agt_state = __PYX_AWAITABLE_STATE_CLOSED;
1028
+ exc_type = PyErr_Occurred();
1029
+ if (__Pyx_PyErr_GivenExceptionMatches2(exc_type, PyExc_StopAsyncIteration, PyExc_GeneratorExit)) {
1030
+ if (o->agt_args == NULL) {
1031
+ // when aclose() is called we don't want to propagate
1032
+ // StopAsyncIteration or GeneratorExit; just raise
1033
+ // StopIteration, signalling that this 'aclose()' await
1034
+ // is done.
1035
+ PyErr_Clear();
1036
+ PyErr_SetNone(PyExc_StopIteration);
1037
+ }
1038
+ }
1039
+ return NULL;
1040
+ }
1041
+
1042
+
1043
+ static PyObject *
1044
+ __Pyx_async_gen_athrow_throw(__pyx_PyAsyncGenAThrow *o, PyObject *args)
1045
+ {
1046
+ PyObject *retval;
1047
+
1048
+ if (unlikely(o->agt_state == __PYX_AWAITABLE_STATE_CLOSED)) {
1049
+ PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_CANNOT_REUSE_CLOSE_MSG);
1050
+ return NULL;
1051
+ }
1052
+
1053
+ retval = __Pyx_Coroutine_Throw((PyObject*)o->agt_gen, args);
1054
+ if (o->agt_args) {
1055
+ return __Pyx_async_gen_unwrap_value(o->agt_gen, retval);
1056
+ } else {
1057
+ // aclose() mode
1058
+ PyObject *exc_type;
1059
+ if (unlikely(retval && __pyx__PyAsyncGenWrappedValue_CheckExact(retval))) {
1060
+ o->agt_gen->ag_running_async = 0;
1061
+ o->agt_state = __PYX_AWAITABLE_STATE_CLOSED;
1062
+ Py_DECREF(retval);
1063
+ PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_IGNORED_EXIT_MSG);
1064
+ return NULL;
1065
+ }
1066
+ exc_type = PyErr_Occurred();
1067
+ if (__Pyx_PyErr_GivenExceptionMatches2(exc_type, PyExc_StopAsyncIteration, PyExc_GeneratorExit)) {
1068
+ // when aclose() is called we don't want to propagate
1069
+ // StopAsyncIteration or GeneratorExit; just raise
1070
+ // StopIteration, signalling that this 'aclose()' await
1071
+ // is done.
1072
+ PyErr_Clear();
1073
+ PyErr_SetNone(PyExc_StopIteration);
1074
+ }
1075
+ return retval;
1076
+ }
1077
+ }
1078
+
1079
+
1080
+ static PyObject *
1081
+ __Pyx_async_gen_athrow_iternext(__pyx_PyAsyncGenAThrow *o)
1082
+ {
1083
+ return __Pyx_async_gen_athrow_send(o, Py_None);
1084
+ }
1085
+
1086
+
1087
+ static PyObject *
1088
+ __Pyx_async_gen_athrow_close(PyObject *g, PyObject *args)
1089
+ {
1090
+ __pyx_PyAsyncGenAThrow *o = (__pyx_PyAsyncGenAThrow*) g;
1091
+ CYTHON_UNUSED_VAR(args);
1092
+ o->agt_state = __PYX_AWAITABLE_STATE_CLOSED;
1093
+ Py_RETURN_NONE;
1094
+ }
1095
+
1096
+
1097
+ static PyMethodDef __Pyx_async_gen_athrow_methods[] = {
1098
+ {"send", (PyCFunction)__Pyx_async_gen_athrow_send, METH_O, __Pyx_async_gen_send_doc},
1099
+ {"throw", (PyCFunction)__Pyx_async_gen_athrow_throw, METH_VARARGS, __Pyx_async_gen_throw_doc},
1100
+ {"close", (PyCFunction)__Pyx_async_gen_athrow_close, METH_NOARGS, __Pyx_async_gen_close_doc},
1101
+ {"__await__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_gen_await_doc},
1102
+ {0, 0, 0, 0} /* Sentinel */
1103
+ };
1104
+
1105
+
1106
+ #if CYTHON_USE_TYPE_SPECS
1107
+ static PyType_Slot __pyx__PyAsyncGenAThrowType_slots[] = {
1108
+ {Py_tp_dealloc, (void *)__Pyx_async_gen_athrow_dealloc},
1109
+ {Py_am_await, (void *)PyObject_SelfIter},
1110
+ {Py_tp_traverse, (void *)__Pyx_async_gen_athrow_traverse},
1111
+ {Py_tp_iter, (void *)PyObject_SelfIter},
1112
+ {Py_tp_iternext, (void *)__Pyx_async_gen_athrow_iternext},
1113
+ {Py_tp_methods, (void *)__Pyx_async_gen_athrow_methods},
1114
+ {Py_tp_getattro, (void *)PyObject_GenericGetAttr},
1115
+ {0, 0},
1116
+ };
1117
+
1118
+ static PyType_Spec __pyx__PyAsyncGenAThrowType_spec = {
1119
+ __PYX_TYPE_MODULE_PREFIX "async_generator_athrow",
1120
+ sizeof(__pyx_PyAsyncGenAThrow),
1121
+ 0,
1122
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
1123
+ __pyx__PyAsyncGenAThrowType_slots
1124
+ };
1125
+ #else /* CYTHON_USE_TYPE_SPECS */
1126
+
1127
+ static __Pyx_PyAsyncMethodsStruct __Pyx_async_gen_athrow_as_async = {
1128
+ PyObject_SelfIter, /* am_await */
1129
+ 0, /* am_aiter */
1130
+ 0, /* am_anext */
1131
+ 0, /* am_send */
1132
+ };
1133
+
1134
+ static PyTypeObject __pyx__PyAsyncGenAThrowType_type = {
1135
+ PyVarObject_HEAD_INIT(0, 0)
1136
+ "async_generator_athrow", /* tp_name */
1137
+ sizeof(__pyx_PyAsyncGenAThrow), /* tp_basicsize */
1138
+ 0, /* tp_itemsize */
1139
+ (destructor)__Pyx_async_gen_athrow_dealloc, /* tp_dealloc */
1140
+ 0, /* tp_vectorcall_offset */
1141
+ 0, /* tp_getattr */
1142
+ 0, /* tp_setattr */
1143
+ __Pyx_SlotTpAsAsync(__Pyx_async_gen_athrow_as_async), /* tp_as_async */
1144
+ 0, /* tp_repr */
1145
+ 0, /* tp_as_number */
1146
+ 0, /* tp_as_sequence */
1147
+ 0, /* tp_as_mapping */
1148
+ 0, /* tp_hash */
1149
+ 0, /* tp_call */
1150
+ 0, /* tp_str */
1151
+ 0, /* tp_getattro */
1152
+ 0, /* tp_setattro */
1153
+ 0, /* tp_as_buffer */
1154
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
1155
+ 0, /* tp_doc */
1156
+ (traverseproc)__Pyx_async_gen_athrow_traverse, /* tp_traverse */
1157
+ 0, /* tp_clear */
1158
+ 0, /*tp_richcompare*/
1159
+ 0, /* tp_weaklistoffset */
1160
+ PyObject_SelfIter, /* tp_iter */
1161
+ (iternextfunc)__Pyx_async_gen_athrow_iternext, /* tp_iternext */
1162
+ __Pyx_async_gen_athrow_methods, /* tp_methods */
1163
+ 0, /* tp_members */
1164
+ 0, /* tp_getset */
1165
+ 0, /* tp_base */
1166
+ 0, /* tp_dict */
1167
+ 0, /* tp_descr_get */
1168
+ 0, /* tp_descr_set */
1169
+ 0, /* tp_dictoffset */
1170
+ 0, /* tp_init */
1171
+ 0, /* tp_alloc */
1172
+ 0, /* tp_new */
1173
+ 0, /* tp_free */
1174
+ 0, /* tp_is_gc */
1175
+ 0, /* tp_bases */
1176
+ 0, /* tp_mro */
1177
+ 0, /* tp_cache */
1178
+ 0, /* tp_subclasses */
1179
+ 0, /* tp_weaklist */
1180
+ 0, /* tp_del */
1181
+ 0, /* tp_version_tag */
1182
+ 0, /* tp_finalize */
1183
+ #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
1184
+ 0, /*tp_vectorcall*/
1185
+ #endif
1186
+ #if __PYX_NEED_TP_PRINT_SLOT
1187
+ 0, /*tp_print*/
1188
+ #endif
1189
+ #if PY_VERSION_HEX >= 0x030C0000
1190
+ 0, /*tp_watched*/
1191
+ #endif
1192
+ #if PY_VERSION_HEX >= 0x030d00A4
1193
+ 0, /*tp_versions_used*/
1194
+ #endif
1195
+ #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
1196
+ 0, /*tp_pypy_flags*/
1197
+ #endif
1198
+ };
1199
+ #endif /* CYTHON_USE_TYPE_SPECS */
1200
+
1201
+
1202
+ static PyObject *
1203
+ __Pyx_async_gen_athrow_new(__pyx_PyAsyncGenObject *gen, PyObject *args)
1204
+ {
1205
+ __pyx_PyAsyncGenAThrow *o;
1206
+ o = PyObject_GC_New(__pyx_PyAsyncGenAThrow, CGLOBAL(__pyx__PyAsyncGenAThrowType));
1207
+ if (unlikely(o == NULL)) {
1208
+ return NULL;
1209
+ }
1210
+ o->agt_gen = gen;
1211
+ o->agt_args = args;
1212
+ o->agt_state = __PYX_AWAITABLE_STATE_INIT;
1213
+ Py_INCREF(gen);
1214
+ Py_XINCREF(args);
1215
+ PyObject_GC_Track((PyObject*)o);
1216
+ return (PyObject*)o;
1217
+ }
1218
+
1219
+
1220
+ /* ---------- global type sharing ------------ */
1221
+
1222
+ static int __pyx_AsyncGen_init(PyObject *module) {
1223
+ $modulestatetype_cname *mstate = __Pyx_PyModule_GetState(module);
1224
+ #if CYTHON_USE_TYPE_SPECS
1225
+ mstate->__pyx_AsyncGenType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_AsyncGenType_spec, NULL);
1226
+ #else
1227
+ CYTHON_MAYBE_UNUSED_VAR(module);
1228
+ // on Windows, C-API functions can't be used in slots statically
1229
+ __pyx_AsyncGenType_type.tp_getattro = PyObject_GenericGetAttr;
1230
+ mstate->__pyx_AsyncGenType = __Pyx_FetchCommonType(&__pyx_AsyncGenType_type);
1231
+ #endif
1232
+ if (unlikely(!mstate->__pyx_AsyncGenType))
1233
+ return -1;
1234
+
1235
+ #if CYTHON_USE_TYPE_SPECS
1236
+ mstate->__pyx__PyAsyncGenAThrowType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx__PyAsyncGenAThrowType_spec, NULL);
1237
+ #else
1238
+ __pyx__PyAsyncGenAThrowType_type.tp_getattro = PyObject_GenericGetAttr;
1239
+ mstate->__pyx__PyAsyncGenAThrowType = __Pyx_FetchCommonType(&__pyx__PyAsyncGenAThrowType_type);
1240
+ #endif
1241
+ if (unlikely(!mstate->__pyx__PyAsyncGenAThrowType))
1242
+ return -1;
1243
+
1244
+ #if CYTHON_USE_TYPE_SPECS
1245
+ mstate->__pyx__PyAsyncGenWrappedValueType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx__PyAsyncGenWrappedValueType_spec, NULL);
1246
+ #else
1247
+ __pyx__PyAsyncGenWrappedValueType_type.tp_getattro = PyObject_GenericGetAttr;
1248
+ mstate->__pyx__PyAsyncGenWrappedValueType = __Pyx_FetchCommonType(&__pyx__PyAsyncGenWrappedValueType_type);
1249
+ #endif
1250
+ if (unlikely(!mstate->__pyx__PyAsyncGenWrappedValueType))
1251
+ return -1;
1252
+
1253
+ #if CYTHON_USE_TYPE_SPECS
1254
+ mstate->__pyx__PyAsyncGenASendType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx__PyAsyncGenASendType_spec, NULL);
1255
+ #else
1256
+ __pyx__PyAsyncGenASendType_type.tp_getattro = PyObject_GenericGetAttr;
1257
+ mstate->__pyx__PyAsyncGenASendType = __Pyx_FetchCommonType(&__pyx__PyAsyncGenASendType_type);
1258
+ #endif
1259
+ if (unlikely(!mstate->__pyx__PyAsyncGenASendType))
1260
+ return -1;
1261
+
1262
+ return 0;
1263
+ }