diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-09-22 16:16:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-22 16:16:52 (GMT) |
commit | 8fd2c3b75b90c4ee391894aa5094615bbdb6242f (patch) | |
tree | a6291ee3fc549c5bb21de9c307321caae317d98f /Python | |
parent | ec403536f1e4cb8ea3519bea43a5fb230ab374f4 (diff) | |
download | cpython-8fd2c3b75b90c4ee391894aa5094615bbdb6242f.zip cpython-8fd2c3b75b90c4ee391894aa5094615bbdb6242f.tar.gz cpython-8fd2c3b75b90c4ee391894aa5094615bbdb6242f.tar.bz2 |
GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97003)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 83c1e1c..9453770 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -6520,11 +6520,14 @@ _PyEval_GetFrame(void) PyFrameObject * PyEval_GetFrame(void) { - PyThreadState *tstate = _PyThreadState_GET(); - if (tstate->cframe->current_frame == NULL) { + _PyInterpreterFrame *frame = _PyEval_GetFrame(); + while (frame && _PyFrame_IsIncomplete(frame)) { + frame = frame->previous; + } + if (frame == NULL) { return NULL; } - PyFrameObject *f = _PyFrame_GetFrameObject(tstate->cframe->current_frame); + PyFrameObject *f = _PyFrame_GetFrameObject(frame); if (f == NULL) { PyErr_Clear(); } |