8000 Avoid accessing "PyGenObject->gi_code", which was removed in CPython … · cython/cython@c96d7fd · GitHub
[go: up one dir, main page]

Skip to content

Commit c96d7fd

Browse files
committed
Avoid accessing "PyGenObject->gi_code", which was removed in CPython 3.12a6 and replaced with a C-API function.
See python/cpython#100749
1 parent 7457387 commit c96d7fd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Cython/Utility/Coroutine.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
185185
} else
186186
#endif
187187
#if CYTHON_COMPILING_IN_CPYTHON && defined(CO_ITERABLE_COROUTINE)
188+
# 60D3 if PY_VERSION_HEX >= 0x030C00A6
189+
if (PyGen_CheckExact(obj) && (PyGen_GetCode(obj)->co_flags & CO_ITERABLE_COROUTINE)) {
190+
#else
188191
if (PyGen_CheckExact(obj) && ((PyGenObject*)obj)->gi_code && ((PyCodeObject *)((PyGenObject*)obj)->gi_code)->co_flags & CO_ITERABLE_COROUTINE) {
192+
#endif
189193
// Python generator marked with "@types.coroutine" decorator
190194
return __Pyx_NewRef(obj);
191195
} else

0 commit comments

Comments
 (0)
0