mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
GH-94262: Don't create frame objects for frames that aren't yet complete. (GH-94371)
This commit is contained in:
parent
1df9449db2
commit
544531de23
7 changed files with 87 additions and 13 deletions
|
@ -1169,8 +1169,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