diff options
author | shadchin <shadchin@yandex-team.com> | 2023-07-22 00:59:02 +0300 |
---|---|---|
committer | shadchin <shadchin@yandex-team.com> | 2023-07-22 00:59:02 +0300 |
commit | 7ecf6c16ab762d4ed40a90ea329eebeb1b8cbca0 (patch) | |
tree | 13f625aacca47c9885d8fa31ba97151706ef63bd /contrib/tools/cython/Cython/Utility | |
parent | 91a8278c558cb2002069ca54215c83568ba6826e (diff) | |
download | ydb-7ecf6c16ab762d4ed40a90ea329eebeb1b8cbca0.tar.gz |
Update Cython to 0.29.36
Diffstat (limited to 'contrib/tools/cython/Cython/Utility')
-rw-r--r-- | contrib/tools/cython/Cython/Utility/AsyncGen.c | 11 | ||||
-rw-r--r-- | contrib/tools/cython/Cython/Utility/Exceptions.c | 26 | ||||
-rw-r--r-- | contrib/tools/cython/Cython/Utility/ModuleSetupCode.c | 12 | ||||
-rw-r--r-- | contrib/tools/cython/Cython/Utility/ObjectHandling.c | 4 |
4 files changed, 45 insertions, 8 deletions
diff --git a/contrib/tools/cython/Cython/Utility/AsyncGen.c b/contrib/tools/cython/Cython/Utility/AsyncGen.c index dd4bf37280..e55b786578 100644 --- a/contrib/tools/cython/Cython/Utility/AsyncGen.c +++ b/contrib/tools/cython/Cython/Utility/AsyncGen.c @@ -202,7 +202,9 @@ __Pyx_async_gen_repr(__pyx_CoroutineObject *o) static int __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) { +#if !CYTHON_COMPILING_IN_PYPY PyThreadState *tstate; +#endif PyObject *finalizer; PyObject *firstiter; @@ -212,15 +214,22 @@ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) o->ag_hooks_inited = 1; +#if CYTHON_COMPILING_IN_PYPY + finalizer = _PyEval_GetAsyncGenFinalizer(); +#else tstate = __Pyx_PyThreadState_Current; - finalizer = tstate->async_gen_finalizer; +#endif if (finalizer) { Py_INCREF(finalizer); o->ag_finalizer = finalizer; } +#if CYTHON_COMPILING_IN_PYPY + firstiter = _PyEval_GetAsyncGenFirstiter(); +#else firstiter = tstate->async_gen_firstiter; +#endif if (firstiter) { PyObject *res; #if CYTHON_UNPACK_METHODS diff --git a/contrib/tools/cython/Cython/Utility/Exceptions.c b/contrib/tools/cython/Cython/Utility/Exceptions.c index 87d3a5cddb..8117b92d4b 100644 --- a/contrib/tools/cython/Cython/Utility/Exceptions.c +++ b/contrib/tools/cython/Cython/Utility/Exceptions.c @@ -6,6 +6,32 @@ // __Pyx_GetException() +/////////////// AssertionsEnabled.init /////////////// +__Pyx_init_assertions_enabled(); + +/////////////// AssertionsEnabled.proto /////////////// + +#define __Pyx_init_assertions_enabled() + +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __pyx_assertions_enabled() (1) +#elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6 + // Py3.8+ has PyConfig from PEP 587, but only Py3.9 added read access to it. + // Py_OptimizeFlag is deprecated in Py3.12+ + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + + #undef __Pyx_init_assertions_enabled + static void __Pyx_init_assertions_enabled(void) { + __pyx_assertions_enabled_flag = ! _PyInterpreterState_GetConfig(__Pyx_PyThreadState_Current->interp)->optimization_level; + } +#else + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + + /////////////// PyThreadStateGet.proto /////////////// //@substitute: naming diff --git a/contrib/tools/cython/Cython/Utility/ModuleSetupCode.c b/contrib/tools/cython/Cython/Utility/ModuleSetupCode.c index 31a8fec231..8503679412 100644 --- a/contrib/tools/cython/Cython/Utility/ModuleSetupCode.c +++ b/contrib/tools/cython/Cython/Utility/ModuleSetupCode.c @@ -93,7 +93,7 @@ #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -455,10 +455,6 @@ class __Pyx_FakeReference { /////////////// PythonCompatibility /////////////// -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif - #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" @@ -547,6 +543,12 @@ class __Pyx_FakeReference { #define __Pyx_DefaultClassType PyType_Type #endif +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif + #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif diff --git a/contrib/tools/cython/Cython/Utility/ObjectHandling.c b/contrib/tools/cython/Cython/Utility/ObjectHandling.c index 02574e46ec..5c4d9e1608 100644 --- a/contrib/tools/cython/Cython/Utility/ObjectHandling.c +++ b/contrib/tools/cython/Cython/Utility/ObjectHandling.c @@ -194,11 +194,11 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* // We always do a quick slot check because calling PyIter_Check() is so wasteful. iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; if (likely(iternext)) { -#if CYTHON_USE_TYPE_SLOTS +#if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY next = iternext(iterator); if (likely(next)) return next; - #if PY_VERSION_HEX >= 0x02070000 + #if PY_VERSION_HEX >= 0x02070000 && CYTHON_COMPILING_IN_CPYTHON if (unlikely(iternext == &_PyObject_NextNotImplemented)) return NULL; #endif |