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