summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-04 18:43:12 (GMT)
committerGitHub <noreply@github.com>2022-07-04 18:43:12 (GMT)
commit68f5fa668343341b79ce1e23f1d9e773b98fd312 (patch)
treebc9b4ab897d1addc94ebf52c643e720fb75944d7 /Objects/frameobject.c
parent8fe0b1d8fa3451e923d7632263be6145a0734468 (diff)
downloadcpython-68f5fa668343341b79ce1e23f1d9e773b98fd312.zip
cpython-68f5fa668343341b79ce1e23f1d9e773b98fd312.tar.gz
cpython-68f5fa668343341b79ce1e23f1d9e773b98fd312.tar.bz2
[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>
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 85cc4a2..cb822a1 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -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;