diff options
author | Mark Shannon <mark@hotpy.org> | 2022-11-10 12:34:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 12:34:57 (GMT) |
commit | 1e197e63e21f77b102ff2601a549dda4b6439455 (patch) | |
tree | 5d8524091404607c838bb9a0ea168c8d9c28fd6a /Python/frame.c | |
parent | dbf2faf579b4094387d65ee41f049456ca67c446 (diff) | |
download | cpython-1e197e63e21f77b102ff2601a549dda4b6439455.zip cpython-1e197e63e21f77b102ff2601a549dda4b6439455.tar.gz cpython-1e197e63e21f77b102ff2601a549dda4b6439455.tar.bz2 |
GH-96421: Insert shim frame on entry to interpreter (GH-96319)
* Adds EXIT_INTERPRETER instruction to exit PyEval_EvalDefault()
* Simplifies RETURN_VALUE, YIELD_VALUE and RETURN_GENERATOR instructions as they no longer need to check for entry frames.
Diffstat (limited to 'Python/frame.c')
-rw-r--r-- | Python/frame.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/frame.c b/Python/frame.c index 89f084b..52f6ef4 100644 --- a/Python/frame.c +++ b/Python/frame.c @@ -80,6 +80,7 @@ _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest) static void take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame) { + assert(frame->owner != FRAME_OWNED_BY_CSTACK); assert(frame->owner != FRAME_OWNED_BY_FRAME_OBJECT); assert(frame->owner != FRAME_CLEARED); Py_ssize_t size = ((char*)&frame->localsplus[frame->stacktop]) - (char *)frame; @@ -99,7 +100,9 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame) while (prev && _PyFrame_IsIncomplete(prev)) { prev = prev->previous; } + frame->previous = NULL; if (prev) { + assert(prev->owner != FRAME_OWNED_BY_CSTACK); /* Link PyFrameObjects.f_back and remove link through _PyInterpreterFrame.previous */ PyFrameObject *back = _PyFrame_GetFrameObject(prev); if (back == NULL) { @@ -111,7 +114,6 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame) else { f->f_back = (PyFrameObject *)Py_NewRef(back); } - frame->previous = NULL; } if (!_PyObject_GC_IS_TRACKED((PyObject *)f)) { _PyObject_GC_TRACK((PyObject *)f); |