Cython 3.2.6__py3-none-any.whl → 3.3.0a2.dev0__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.
Potentially problematic release.
This version of Cython might be problematic. Click here for more details.
- Cython/Build/BuildExecutable.py +1 -14
- Cython/Build/Dependencies.py +6 -44
- Cython/Build/Inline.py +7 -3
- Cython/Build/IpythonMagic.py +0 -1
- Cython/Build/SharedModule.py +1 -2
- Cython/Build/Tests/TestCythonizeArgsParser.py +6 -6
- Cython/Build/Tests/TestDependencies.py +3 -3
- Cython/Build/Tests/TestInline.py +3 -3
- Cython/Build/Tests/TestIpythonMagic.py +35 -19
- Cython/Build/Tests/TestStripLiterals.py +2 -2
- Cython/Compiler/Buffer.py +5 -5
- Cython/Compiler/Builtin.py +57 -46
- Cython/Compiler/Code.pxd +12 -9
- Cython/Compiler/Code.py +220 -94
- Cython/Compiler/Dataclass.py +78 -52
- Cython/Compiler/Errors.py +21 -8
- Cython/Compiler/ExprNodes.py +871 -459
- Cython/Compiler/FlowControl.pxd +8 -6
- Cython/Compiler/FlowControl.py +111 -8
- Cython/Compiler/FusedNode.py +17 -12
- Cython/Compiler/Lexicon.py +123 -122
- Cython/Compiler/Main.py +3 -4
- Cython/Compiler/MatchCaseNodes.py +1948 -10
- Cython/Compiler/MemoryView.py +62 -33
- Cython/Compiler/ModuleNode.py +559 -283
- Cython/Compiler/Naming.py +4 -0
- Cython/Compiler/Nodes.py +333 -197
- Cython/Compiler/Optimize.py +268 -112
- Cython/Compiler/Options.py +0 -5
- Cython/Compiler/ParseTreeTransforms.pxd +2 -1
- Cython/Compiler/ParseTreeTransforms.py +180 -76
- Cython/Compiler/Parsing.py +55 -38
- Cython/Compiler/PyrexTypes.py +364 -128
- Cython/Compiler/Scanning.pxd +27 -5
- Cython/Compiler/Scanning.py +24 -14
- Cython/Compiler/StringEncoding.py +1 -2
- Cython/Compiler/Symtab.py +27 -19
- Cython/Compiler/Tests/TestBuiltin.py +41 -6
- Cython/Compiler/Tests/TestCmdLine.py +3 -2
- Cython/Compiler/Tests/TestCode.py +4 -3
- Cython/Compiler/Tests/TestFlowControl.py +2 -2
- Cython/Compiler/Tests/TestParseTreeTransforms.py +2 -2
- Cython/Compiler/Tests/TestScanning.py +2 -4
- Cython/Compiler/Tests/TestSignatureMatching.py +3 -3
- Cython/Compiler/Tests/TestStringEncoding.py +2 -3
- Cython/Compiler/Tests/TestTypes.py +46 -3
- Cython/Compiler/Tests/TestUtilityLoad.py +4 -4
- Cython/Compiler/TypeInference.py +20 -0
- Cython/Compiler/TypeSlots.py +171 -16
- Cython/Compiler/UtilNodes.py +24 -0
- Cython/Compiler/UtilityCode.py +1 -0
- Cython/Compiler/Visitor.pxd +1 -1
- Cython/Compiler/Visitor.py +3 -2
- Cython/Debugger/Tests/TestLibCython.py +7 -2
- Cython/Debugger/Tests/test_libcython_in_gdb.py +4 -2
- Cython/Debugger/Tests/test_libpython_in_gdb.py +1 -1
- Cython/Includes/cpython/array.pxd +5 -5
- Cython/Includes/cpython/dict.pxd +1 -6
- Cython/Includes/cpython/float.pxd +19 -10
- Cython/Includes/cpython/frozendict.pxd +37 -0
- Cython/Includes/cpython/long.pxd +31 -0
- Cython/Includes/cpython/object.pxd +9 -12
- Cython/Includes/cpython/sentinel.pxd +17 -0
- Cython/Includes/cpython/type.pxd +93 -0
- Cython/Includes/libcpp/exception.pxd +90 -0
- Cython/LZSS.py +170 -0
- Cython/Shadow.py +550 -73
- Cython/StringIOTree.py +1 -2
- Cython/Tempita/_tempita.py +45 -46
- Cython/TestUtils.py +50 -8
- Cython/Tests/TestCythonUtils.py +2 -2
- Cython/Tests/TestJediTyper.py +1 -1
- Cython/Tests/TestShadow.py +7 -5
- Cython/Tests/TestStringIOTree.py +4 -3
- Cython/Tests/TestTestUtils.py +2 -3
- Cython/Utility/AsyncGen.c +59 -19
- Cython/Utility/Buffer.c +4 -3
- Cython/Utility/Builtins.c +139 -17
- Cython/Utility/CConvert.pyx +27 -12
- Cython/Utility/CommonStructures.c +55 -37
- Cython/Utility/Coroutine.c +112 -68
- Cython/Utility/CythonFunction.c +607 -330
- Cython/Utility/Embed.c +8 -0
- Cython/Utility/Exceptions.c +20 -3
- Cython/Utility/ExtensionTypes.c +414 -224
- Cython/Utility/FunctionArguments.c +83 -81
- Cython/Utility/ImportExport.c +72 -61
- Cython/Utility/MatchCase.c +979 -0
- Cython/Utility/MatchCase_Cy.pyx +12 -0
- Cython/Utility/MemoryView.pxd +9 -88
- Cython/Utility/MemoryView.pyx +173 -61
- Cython/Utility/MemoryView_C.c +3 -3
- Cython/Utility/ModuleSetupCode.c +306 -157
- Cython/Utility/ObjectHandling.c +483 -404
- Cython/Utility/Optimize.c +1117 -164
- Cython/Utility/Overflow.c +3 -9
- Cython/Utility/Profile.c +4 -0
- Cython/Utility/StringTools.c +187 -149
- Cython/Utility/Synchronization.c +39 -0
- Cython/Utility/TString.c +24 -13
- Cython/Utility/TypeConversion.c +405 -250
- Cython/Utility/arrayarray.h +24 -22
- Cython/Utils.py +11 -23
- Cython/__init__.py +3 -1
- {cython-3.2.6.dist-info → cython-3.3.0a2.dev0.dist-info}/METADATA +14 -33
- {cython-3.2.6.dist-info → cython-3.3.0a2.dev0.dist-info}/RECORD +109 -107
- {cython-3.2.6.dist-info → cython-3.3.0a2.dev0.dist-info}/WHEEL +1 -1
- Cython/Shadow.pyi +0 -521
- Cython/Utility/Printing.c +0 -86
- Cython/__init__.pyi +0 -7
- {cython-3.2.6.dist-info → cython-3.3.0a2.dev0.dist-info}/entry_points.txt +0 -0
- {cython-3.2.6.dist-info → cython-3.3.0a2.dev0.dist-info}/top_level.txt +0 -0
Cython/Utility/Coroutine.c
CHANGED
|
@@ -59,13 +59,12 @@ static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_Corouti
|
|
|
59
59
|
//@requires: Generator
|
|
60
60
|
//@requires: CoroutineSetYieldFrom
|
|
61
61
|
//@requires: ObjectHandling.c::IterNextPlain
|
|
62
|
+
//@requires: ObjectHandling.c::RaiseErrorWithObjectType
|
|
62
63
|
|
|
63
64
|
#if CYTHON_USE_TYPE_SLOTS
|
|
64
65
|
static void __Pyx_PyIter_CheckErrorAndDecref(PyObject *source) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source_type_name);
|
|
68
|
-
__Pyx_DECREF_TypeName(source_type_name);
|
|
66
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
67
|
+
"iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source);
|
|
69
68
|
Py_DECREF(source);
|
|
70
69
|
}
|
|
71
70
|
#endif
|
|
@@ -199,6 +198,7 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *o); /*proto*/
|
|
|
199
198
|
//@requires: ObjectHandling.c::PyObjectGetMethod
|
|
200
199
|
//@requires: ObjectHandling.c::PyObjectCallNoArg
|
|
201
200
|
//@requires: ObjectHandling.c::PyObjectCallOneArg
|
|
201
|
+
//@requires: ObjectHandling.c::RaiseErrorWithObjectType
|
|
202
202
|
//@requires: Coro_CheckExact
|
|
203
203
|
|
|
204
204
|
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) {
|
|
@@ -217,28 +217,31 @@ static void __Pyx_Coroutine_AwaitableIterError(PyObject *source) {
|
|
|
217
217
|
_PyErr_FormatFromCause(PyExc_TypeError,
|
|
218
218
|
"'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME, source_type_name);
|
|
219
219
|
__Pyx_DECREF_TypeName(source_type_name);
|
|
220
|
+
|
|
220
221
|
#else
|
|
221
222
|
PyObject *exc, *val, *val2, *tb;
|
|
222
|
-
__Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source));
|
|
223
223
|
assert(PyErr_Occurred());
|
|
224
|
-
|
|
224
|
+
__Pyx_PyErr_FetchException(&exc, &val, &tb);
|
|
225
|
+
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
|
|
225
226
|
PyErr_NormalizeException(&exc, &val, &tb);
|
|
226
227
|
if (tb != NULL) {
|
|
227
228
|
PyException_SetTraceback(val, tb);
|
|
228
229
|
Py_DECREF(tb);
|
|
229
230
|
}
|
|
230
231
|
Py_DECREF(exc);
|
|
232
|
+
#endif
|
|
231
233
|
assert(!PyErr_Occurred());
|
|
232
|
-
|
|
233
|
-
"'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME,
|
|
234
|
-
__Pyx_DECREF_TypeName(source_type_name);
|
|
234
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
235
|
+
"'async for' received an invalid object from __anext__: " __Pyx_FMT_TYPENAME, source);
|
|
235
236
|
|
|
236
|
-
|
|
237
|
+
__Pyx_PyErr_FetchException(&exc, &val2, &tb);
|
|
238
|
+
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
|
|
237
239
|
PyErr_NormalizeException(&exc, &val2, &tb);
|
|
240
|
+
#endif
|
|
238
241
|
Py_INCREF(val);
|
|
239
242
|
PyException_SetCause(val2, val);
|
|
240
243
|
PyException_SetContext(val2, val);
|
|
241
|
-
|
|
244
|
+
__Pyx_PyErr_RestoreException(exc, val2, tb);
|
|
242
245
|
#endif
|
|
243
246
|
}
|
|
244
247
|
|
|
@@ -252,25 +255,26 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
|
|
|
252
255
|
} else
|
|
253
256
|
#if CYTHON_COMPILING_IN_CPYTHON && defined(CO_ITERABLE_COROUTINE)
|
|
254
257
|
#if PY_VERSION_HEX >= 0x030C00A6
|
|
255
|
-
if (PyGen_CheckExact(obj) && (PyGen_GetCode((PyGenObject*)obj)->co_flags & CO_ITERABLE_COROUTINE))
|
|
258
|
+
if (PyGen_CheckExact(obj) && (PyGen_GetCode((PyGenObject*)obj)->co_flags & CO_ITERABLE_COROUTINE))
|
|
256
259
|
#else
|
|
257
|
-
if (PyGen_CheckExact(obj) && ((PyGenObject*)obj)->gi_code && ((PyCodeObject *)((PyGenObject*)obj)->gi_code)->co_flags & CO_ITERABLE_COROUTINE)
|
|
260
|
+
if (PyGen_CheckExact(obj) && ((PyGenObject*)obj)->gi_code && ((PyCodeObject *)((PyGenObject*)obj)->gi_code)->co_flags & CO_ITERABLE_COROUTINE)
|
|
258
261
|
#endif
|
|
262
|
+
{
|
|
259
263
|
// Python generator marked with "@types.coroutine" decorator
|
|
260
264
|
return __Pyx_NewRef(obj);
|
|
261
265
|
} else
|
|
262
266
|
#endif
|
|
263
267
|
{
|
|
264
|
-
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 ||
|
|
268
|
+
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || !CYTHON_COMPILING_IN_LIMITED_API)
|
|
265
269
|
PyObject *args[] = { obj };
|
|
266
270
|
res = PyObject_VectorcallMethod(PYIDENT("__await__"), args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
|
267
271
|
if (unlikely(!res)) {
|
|
268
272
|
// We need to distinguish between "doesn't have __await__" vs "__await__ failed"
|
|
269
273
|
if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
|
270
274
|
PyObject *type, *value, *traceback;
|
|
271
|
-
|
|
275
|
+
__Pyx_PyErr_FetchException(&type, &value, &traceback);
|
|
272
276
|
int has_attr = PyObject_HasAttr(obj, PYIDENT("__await__"));
|
|
273
|
-
|
|
277
|
+
__Pyx_PyErr_RestoreException(type, value, traceback);
|
|
274
278
|
if (!has_attr) goto slot_error;
|
|
275
279
|
}
|
|
276
280
|
}
|
|
@@ -292,10 +296,8 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
|
|
|
292
296
|
goto bad;
|
|
293
297
|
}
|
|
294
298
|
if (unlikely(!PyIter_Check(res))) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
"__await__() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", res_type_name);
|
|
298
|
-
__Pyx_DECREF_TypeName(res_type_name);
|
|
299
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
300
|
+
"__await__() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", res);
|
|
299
301
|
Py_CLEAR(res);
|
|
300
302
|
} else {
|
|
301
303
|
int is_coroutine = 0;
|
|
@@ -313,12 +315,8 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
|
|
|
313
315
|
}
|
|
314
316
|
return res;
|
|
315
317
|
slot_error:
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
PyErr_Format(PyExc_TypeError,
|
|
319
|
-
"object " __Pyx_FMT_TYPENAME " can't be used in 'await' expression", obj_type_name);
|
|
320
|
-
__Pyx_DECREF_TypeName(obj_type_name);
|
|
321
|
-
}
|
|
318
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
319
|
+
"object " __Pyx_FMT_TYPENAME " can't be used in 'await' expression", obj);
|
|
322
320
|
bad:
|
|
323
321
|
return NULL;
|
|
324
322
|
}
|
|
@@ -330,14 +328,12 @@ static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAsyncIter(PyObject *o); /*prot
|
|
|
330
328
|
static CYTHON_INLINE PyObject *__Pyx_Coroutine_AsyncIterNext(PyObject *o); /*proto*/
|
|
331
329
|
|
|
332
330
|
//////////////////// AsyncIter ////////////////////
|
|
331
|
+
//@requires: ObjectHandling.c::RaiseErrorWithObjectType
|
|
333
332
|
//@requires: GetAwaitIter
|
|
334
333
|
|
|
335
|
-
static
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
"'async for' requires an object with __aiter__ method, got " __Pyx_FMT_TYPENAME, obj_type_name);
|
|
339
|
-
__Pyx_DECREF_TypeName(obj_type_name);
|
|
340
|
-
return NULL;
|
|
334
|
+
static void __Pyx_Coroutine_GetAsyncIter_Fail(PyObject *obj) {
|
|
335
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
336
|
+
"'async for' requires an object with __aiter__ method, got " __Pyx_FMT_TYPENAME, obj);
|
|
341
337
|
}
|
|
342
338
|
|
|
343
339
|
|
|
@@ -353,16 +349,14 @@ static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAsyncIter(PyObject *obj) {
|
|
|
353
349
|
return (*am_aiter)(obj);
|
|
354
350
|
}
|
|
355
351
|
}
|
|
356
|
-
|
|
352
|
+
__Pyx_Coroutine_GetAsyncIter_Fail(obj);
|
|
353
|
+
return NULL;
|
|
357
354
|
}
|
|
358
355
|
|
|
359
356
|
|
|
360
|
-
static
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
"'async for' requires an object with __anext__ method, got " __Pyx_FMT_TYPENAME, obj_type_name);
|
|
364
|
-
__Pyx_DECREF_TypeName(obj_type_name);
|
|
365
|
-
return NULL;
|
|
357
|
+
static void __Pyx_Coroutine_AsyncIterNext_Fail(PyObject *obj) {
|
|
358
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
359
|
+
"'async for' requires an object with __anext__ method, got " __Pyx_FMT_TYPENAME, obj);
|
|
366
360
|
}
|
|
367
361
|
|
|
368
362
|
|
|
@@ -378,7 +372,8 @@ static CYTHON_INLINE PyObject *__Pyx_Coroutine_AsyncIterNext(PyObject *obj) {
|
|
|
378
372
|
return (*am_anext)(obj);
|
|
379
373
|
}
|
|
380
374
|
}
|
|
381
|
-
|
|
375
|
+
__Pyx_Coroutine_AsyncIterNext_Fail(obj);
|
|
376
|
+
return NULL;
|
|
382
377
|
}
|
|
383
378
|
|
|
384
379
|
|
|
@@ -480,7 +475,13 @@ static int __Pyx_Coroutine_clear(PyObject *self); /*proto*/
|
|
|
480
475
|
static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval); /*proto*/
|
|
481
476
|
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); /*proto*/
|
|
482
477
|
static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval); /*proto*/
|
|
483
|
-
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen,
|
|
478
|
+
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen,
|
|
479
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
480
|
+
PyObject *args
|
|
481
|
+
#else
|
|
482
|
+
PyObject *const *args, Py_ssize_t nargs
|
|
483
|
+
#endif
|
|
484
|
+
); /*proto*/
|
|
484
485
|
|
|
485
486
|
// macros for exception state swapping instead of inline functions to make use of the local thread state context
|
|
486
487
|
#if CYTHON_USE_EXC_INFO_STACK
|
|
@@ -521,10 +522,10 @@ static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);
|
|
|
521
522
|
//////////////////// Coroutine.proto ////////////////////
|
|
522
523
|
|
|
523
524
|
#define __Pyx_Coroutine_USED
|
|
524
|
-
#define __Pyx_Coroutine_CheckExact(obj)
|
|
525
|
+
#define __Pyx_Coroutine_CheckExact(obj) Py_IS_TYPE(obj, CGLOBAL(__pyx_CoroutineType))
|
|
525
526
|
// __Pyx_Coroutine_Check(obj): see override for IterableCoroutine below
|
|
526
527
|
#define __Pyx_Coroutine_Check(obj) __Pyx_Coroutine_CheckExact(obj)
|
|
527
|
-
#define __Pyx_CoroutineAwait_CheckExact(obj)
|
|
528
|
+
#define __Pyx_CoroutineAwait_CheckExact(obj) Py_IS_TYPE(obj, CGLOBAL(__pyx_CoroutineAwaitType))
|
|
528
529
|
|
|
529
530
|
#define __Pyx_Coroutine_New(body, code, closure, name, qualname, module_name) \
|
|
530
531
|
__Pyx__Coroutine_New(CGLOBAL(__pyx_CoroutineType), body, code, closure, name, qualname, module_name)
|
|
@@ -543,7 +544,7 @@ static __Pyx_PySendResult __Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject
|
|
|
543
544
|
//////////////////// Generator.proto ////////////////////
|
|
544
545
|
|
|
545
546
|
#define __Pyx_Generator_USED
|
|
546
|
-
#define __Pyx_Generator_CheckExact(obj)
|
|
547
|
+
#define __Pyx_Generator_CheckExact(obj) Py_IS_TYPE(obj, CGLOBAL(__pyx_GeneratorType))
|
|
547
548
|
|
|
548
549
|
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name) \
|
|
549
550
|
__Pyx__Coroutine_New(CGLOBAL(__pyx_GeneratorType), body, code, closure, name, qualname, module_name)
|
|
@@ -572,6 +573,7 @@ static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);
|
|
|
572
573
|
//@requires: ObjectHandling.c::PyObjectFastCall
|
|
573
574
|
//@requires: ObjectHandling.c::PyObjectGetAttrStr
|
|
574
575
|
//@requires: ObjectHandling.c::PyObjectGetAttrStrNoError
|
|
576
|
+
//@requires: ObjectHandling.c::RaiseErrorWithObjectType
|
|
575
577
|
//@requires: ObjectHandling.c::IterNextPlain
|
|
576
578
|
//@requires: CommonStructures.c::FetchCommonType
|
|
577
579
|
//@requires: CommonStructures.c::CommonTypesMetaclass
|
|
@@ -624,7 +626,7 @@ static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *$local_tstate_cna
|
|
|
624
626
|
Py_INCREF(Py_None);
|
|
625
627
|
value = Py_None;
|
|
626
628
|
}
|
|
627
|
-
else if (likely(
|
|
629
|
+
else if (likely(Py_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
|
|
628
630
|
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
|
|
629
631
|
value = PyObject_GetAttr(ev, PYIDENT("value"));
|
|
630
632
|
if (unlikely(!value)) goto limited_api_failure;
|
|
@@ -1068,12 +1070,9 @@ __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
|
|
|
1068
1070
|
#endif
|
|
1069
1071
|
#endif
|
|
1070
1072
|
{
|
|
1071
|
-
#if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
|
|
1072
|
-
// PyIter_Check() is needed here but broken in the Py3.7 Limited API.
|
|
1073
1073
|
if (value == Py_None && PyIter_Check(yf))
|
|
1074
1074
|
ret = __Pyx_PyIter_Next_Plain(yf);
|
|
1075
1075
|
else
|
|
1076
|
-
#endif
|
|
1077
1076
|
ret = __Pyx_PyObject_CallMethod1(yf, PYIDENT("send"), value);
|
|
1078
1077
|
}
|
|
1079
1078
|
if (likely(ret)) {
|
|
@@ -1308,7 +1307,7 @@ static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject
|
|
|
1308
1307
|
__Pyx_Coroutine_Undelegate(gen);
|
|
1309
1308
|
goto throw_here;
|
|
1310
1309
|
}
|
|
1311
|
-
if (
|
|
1310
|
+
if (args) {
|
|
1312
1311
|
ret = __Pyx_PyObject_Call(meth, args, NULL);
|
|
1313
1312
|
} else {
|
|
1314
1313
|
// "tb" or even "val" might be NULL.
|
|
@@ -1340,15 +1339,44 @@ propagate_exception:
|
|
|
1340
1339
|
}
|
|
1341
1340
|
}
|
|
1342
1341
|
|
|
1343
|
-
static PyObject *__Pyx_Coroutine_Throw(PyObject *self,
|
|
1342
|
+
static PyObject *__Pyx_Coroutine_Throw(PyObject *self,
|
|
1343
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
1344
|
+
PyObject *args
|
|
1345
|
+
#else
|
|
1346
|
+
PyObject *const *args, Py_ssize_t nargs
|
|
1347
|
+
#endif
|
|
1348
|
+
) {
|
|
1344
1349
|
PyObject *typ;
|
|
1345
1350
|
PyObject *val = NULL;
|
|
1346
1351
|
PyObject *tb = NULL;
|
|
1347
1352
|
|
|
1353
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
1348
1354
|
if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
|
|
1349
1355
|
return NULL;
|
|
1356
|
+
#else
|
|
1357
|
+
switch (nargs) {
|
|
1358
|
+
case 3:
|
|
1359
|
+
tb = args[2];
|
|
1360
|
+
CYTHON_FALLTHROUGH;
|
|
1361
|
+
case 2:
|
|
1362
|
+
val = args[1];
|
|
1363
|
+
CYTHON_FALLTHROUGH;
|
|
1364
|
+
case 1:
|
|
1365
|
+
typ = args[0];
|
|
1366
|
+
break;
|
|
1367
|
+
default:
|
|
1368
|
+
PyErr_SetString(PyExc_TypeError, "throw takes between 1 and 3 positional arguments");
|
|
1369
|
+
return NULL;
|
|
1370
|
+
}
|
|
1371
|
+
#endif
|
|
1350
1372
|
|
|
1351
|
-
return __Pyx__Coroutine_Throw(self, typ, val, tb,
|
|
1373
|
+
return __Pyx__Coroutine_Throw(self, typ, val, tb,
|
|
1374
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
1375
|
+
args,
|
|
1376
|
+
#else
|
|
1377
|
+
NULL,
|
|
1378
|
+
#endif
|
|
1379
|
+
1);
|
|
1352
1380
|
}
|
|
1353
1381
|
|
|
1354
1382
|
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
|
|
@@ -1405,21 +1433,15 @@ static void __Pyx_Coroutine_dealloc(PyObject *self) {
|
|
|
1405
1433
|
|
|
1406
1434
|
if (gen->resume_label >= 0) {
|
|
1407
1435
|
// Generator is paused or unstarted, so we need to close
|
|
1408
|
-
PyObject_GC_Track(self);
|
|
1409
1436
|
#if CYTHON_USE_TP_FINALIZE
|
|
1437
|
+
PyObject_GC_Track(self);
|
|
1410
1438
|
if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
|
|
1411
|
-
#else
|
|
1412
|
-
{
|
|
1413
|
-
destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
|
|
1414
|
-
if (del) del(self);
|
|
1415
|
-
}
|
|
1416
|
-
if (unlikely(Py_REFCNT(self) > 0))
|
|
1417
|
-
#endif
|
|
1418
1439
|
{
|
|
1419
1440
|
// resurrected. :(
|
|
1420
1441
|
return;
|
|
1421
1442
|
}
|
|
1422
1443
|
PyObject_GC_UnTrack(self);
|
|
1444
|
+
#endif
|
|
1423
1445
|
}
|
|
1424
1446
|
|
|
1425
1447
|
#ifdef __Pyx_AsyncGen_USED
|
|
@@ -1654,6 +1676,10 @@ static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
|
|
|
1654
1676
|
Py_XINCREF(code);
|
|
1655
1677
|
gen->gi_code = code;
|
|
1656
1678
|
gen->gi_frame = NULL;
|
|
1679
|
+
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
|
|
1680
|
+
memset(gen->$monitoring_states_cname, 0, sizeof(gen->$monitoring_states_cname));
|
|
1681
|
+
gen->$monitoring_version_cname = 0;
|
|
1682
|
+
#endif
|
|
1657
1683
|
|
|
1658
1684
|
PyObject_GC_Track(gen);
|
|
1659
1685
|
return gen;
|
|
@@ -1722,11 +1748,8 @@ static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethods
|
|
|
1722
1748
|
// #if CYTHON_USE_TYPE_SPECS
|
|
1723
1749
|
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
|
|
1724
1750
|
CYTHON_UNUSED_VAR(arg);
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
|
|
1728
|
-
self_type_name);
|
|
1729
|
-
__Pyx_DECREF_TypeName(self_type_name);
|
|
1751
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
1752
|
+
"cannot pickle '" __Pyx_FMT_TYPENAME "' object", self);
|
|
1730
1753
|
return NULL;
|
|
1731
1754
|
}
|
|
1732
1755
|
// #endif
|
|
@@ -1790,9 +1813,15 @@ static __Pyx_PySendResult __Pyx_CoroutineAwait_AmSend(PyObject *self, PyObject *
|
|
|
1790
1813
|
}
|
|
1791
1814
|
#endif
|
|
1792
1815
|
|
|
1816
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
1793
1817
|
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args) {
|
|
1794
1818
|
return __Pyx_Coroutine_Throw(self->coroutine, args);
|
|
1795
1819
|
}
|
|
1820
|
+
#else
|
|
1821
|
+
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *const *args, Py_ssize_t nargs) {
|
|
1822
|
+
return __Pyx_Coroutine_Throw(self->coroutine, args, nargs);
|
|
1823
|
+
}
|
|
1824
|
+
#endif
|
|
1796
1825
|
|
|
1797
1826
|
static __Pyx_PySendResult __Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self) {
|
|
1798
1827
|
PyObject *retval = NULL;
|
|
@@ -1830,7 +1859,12 @@ static PyObject *__Pyx_CoroutineAwait_no_new(PyTypeObject *type, PyObject *args,
|
|
|
1830
1859
|
static PyMethodDef __pyx_CoroutineAwait_methods[] = {
|
|
1831
1860
|
{"send", (PyCFunction) __Pyx_CoroutineAwait_Send, METH_O,
|
|
1832
1861
|
PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next yielded value or raise StopIteration.")},
|
|
1833
|
-
{"throw", (PyCFunction
|
|
1862
|
+
{"throw", __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_CoroutineAwait_Throw),
|
|
1863
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
1864
|
+
METH_VARARGS,
|
|
1865
|
+
#else
|
|
1866
|
+
METH_FASTCALL,
|
|
1867
|
+
#endif
|
|
1834
1868
|
PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next yielded value or raise StopIteration.")},
|
|
1835
1869
|
{"close", (PyCFunction) __Pyx_CoroutineAwait_Close_Method, METH_NOARGS, PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
|
|
1836
1870
|
// only needed with type-specs, but included in all versions for clarity
|
|
@@ -1890,7 +1924,12 @@ static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) {
|
|
|
1890
1924
|
static PyMethodDef __pyx_Coroutine_methods[] = {
|
|
1891
1925
|
{"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
|
|
1892
1926
|
PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")},
|
|
1893
|
-
{"throw", (PyCFunction
|
|
1927
|
+
{"throw", __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_Coroutine_Throw),
|
|
1928
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
1929
|
+
METH_VARARGS,
|
|
1930
|
+
#else
|
|
1931
|
+
METH_FASTCALL,
|
|
1932
|
+
#endif
|
|
1894
1933
|
PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next iterated value or raise StopIteration.")},
|
|
1895
1934
|
{"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
|
|
1896
1935
|
{"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
|
|
@@ -2004,7 +2043,7 @@ if (likely(__pyx_IterableCoroutine_init($module_cname) == 0)); else
|
|
|
2004
2043
|
#define __Pyx_IterableCoroutine_USED
|
|
2005
2044
|
|
|
2006
2045
|
#undef __Pyx_Coroutine_Check
|
|
2007
|
-
#define __Pyx_Coroutine_Check(obj) (__Pyx_Coroutine_CheckExact(obj) ||
|
|
2046
|
+
#define __Pyx_Coroutine_Check(obj) (__Pyx_Coroutine_CheckExact(obj) || Py_IS_TYPE(obj, CGLOBAL(__pyx_IterableCoroutineType)))
|
|
2008
2047
|
|
|
2009
2048
|
#define __Pyx_IterableCoroutine_New(body, code, closure, name, qualname, module_name) \
|
|
2010
2049
|
__Pyx__Coroutine_New(CGLOBAL(__pyx_IterableCoroutineType), body, code, closure, name, qualname, module_name)
|
|
@@ -2086,7 +2125,12 @@ if (likely(__pyx_Generator_init($module_cname) == 0)); else
|
|
|
2086
2125
|
static PyMethodDef __pyx_Generator_methods[] = {
|
|
2087
2126
|
{"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
|
|
2088
2127
|
PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
|
|
2089
|
-
{"throw", (PyCFunction
|
|
2128
|
+
{"throw", __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_Coroutine_Throw),
|
|
2129
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
|
|
2130
|
+
METH_VARARGS,
|
|
2131
|
+
#else
|
|
2132
|
+
METH_FASTCALL,
|
|
2133
|
+
#endif
|
|
2090
2134
|
PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
|
|
2091
2135
|
{"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
|
|
2092
2136
|
PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
|