Commit 3f564847 authored by da-woods's avatar da-woods Committed by GitHub

Use new C-API function to get the current frame on Python 3.11 alpha (GH-4427)

Use the accessor function instead of the direct struct member (which is now the wrong type).

Closes https://github.com/cython/cython/issues/4416
parent 8d2df028
......@@ -719,8 +719,7 @@ PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, i
exc_state = &self->gi_exc_state;
if (exc_state->exc_type) {
#if CYTHON_COMPILING_IN_PYPY || PY_VERSION_HEX >= 0x030B00A1
// FIXME: https://bugs.python.org/issue44590 - Python 3.11 changed the type of frame
#if CYTHON_COMPILING_IN_PYPY
// FIXME: what to do in PyPy?
#else
// Generators always return to their most recent caller, not
......@@ -729,9 +728,14 @@ PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, i
PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
PyFrameObject *f = tb->tb_frame;
Py_XINCREF(tstate->frame);
assert(f->f_back == NULL);
#if PY_VERSION_HEX >= 0x030B00A1
// FIXME: unclear what to do if PyThreadState_GetFrame fails
f->f_back = PyThreadState_GetFrame(tstate);
#else
Py_XINCREF(tstate->frame);
f->f_back = tstate->frame;
#endif
}
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment