mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
[3.11] GH-94262: Don't create frame objects for frames that aren't yet complete. (GH-94371) (#94482)
Co-authored-by: Mark Shannon <mark@hotpy.org>
This commit is contained in:
parent
8fe0b1d8fa
commit
68f5fa6683
7 changed files with 87 additions and 13 deletions
|
@ -66,9 +66,13 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
|
|||
f->f_frame = frame;
|
||||
frame->owner = FRAME_OWNED_BY_FRAME_OBJECT;
|
||||
assert(f->f_back == NULL);
|
||||
if (frame->previous != NULL) {
|
||||
_PyInterpreterFrame *prev = frame->previous;
|
||||
while (prev && _PyFrame_IsIncomplete(prev)) {
|
||||
prev = prev->previous;
|
||||
}
|
||||
if (prev) {
|
||||
/* Link PyFrameObjects.f_back and remove link through _PyInterpreterFrame.previous */
|
||||
PyFrameObject *back = _PyFrame_GetFrameObject(frame->previous);
|
||||
PyFrameObject *back = _PyFrame_GetFrameObject(prev);
|
||||
if (back == NULL) {
|
||||
/* Memory error here. */
|
||||
assert(PyErr_ExceptionMatches(PyExc_MemoryError));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue