mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +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
|
@ -1155,8 +1155,14 @@ PyFrame_GetBack(PyFrameObject *frame)
|
|||
{
|
||||
assert(frame != NULL);
|
||||
PyFrameObject *back = frame->f_back;
|
||||
if (back == NULL && frame->f_frame->previous != NULL) {
|
||||
back = _PyFrame_GetFrameObject(frame->f_frame->previous);
|
||||
if (back == NULL) {
|
||||
_PyInterpreterFrame *prev = frame->f_frame->previous;
|
||||
while (prev && _PyFrame_IsIncomplete(prev)) {
|
||||
prev = prev->previous;
|
||||
}
|
||||
if (prev) {
|
||||
back = _PyFrame_GetFrameObject(prev);
|
||||
}
|
||||
}
|
||||
Py_XINCREF(back);
|
||||
return back;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue