diff options
author | Mark Shannon <mark@hotpy.org> | 2022-09-13 08:25:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 08:25:16 (GMT) |
commit | 12c5f328d2479ac3432df5e266adc4e59adeabfe (patch) | |
tree | cdeb3338ca209b81ae0b4c321b52a0d9b19a762d /Python | |
parent | 1756ffd66a38755cd45de51316d66266ae30e132 (diff) | |
download | cpython-12c5f328d2479ac3432df5e266adc4e59adeabfe.zip cpython-12c5f328d2479ac3432df5e266adc4e59adeabfe.tar.gz cpython-12c5f328d2479ac3432df5e266adc4e59adeabfe.tar.bz2 |
GH-96754: Check whether the interpreter frame is complete before creating frame object. (GH-96776)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 8 | ||||
-rw-r--r-- | Python/pystate.c | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 20d0e1c..091b0eb 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5113,9 +5113,11 @@ error: #endif /* Log traceback info. */ - PyFrameObject *f = _PyFrame_GetFrameObject(frame); - if (f != NULL) { - PyTraceBack_Here(f); + if (!_PyFrame_IsIncomplete(frame)) { + PyFrameObject *f = _PyFrame_GetFrameObject(frame); + if (f != NULL) { + PyTraceBack_Here(f); + } } if (tstate->c_tracefunc != NULL) { diff --git a/Python/pystate.c b/Python/pystate.c index a0d61d7..23e9d24 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1406,6 +1406,9 @@ _PyThread_CurrentFrames(void) PyThreadState *t; for (t = i->threads.head; t != NULL; t = t->next) { _PyInterpreterFrame *frame = t->cframe->current_frame; + while (frame && _PyFrame_IsIncomplete(frame)) { + frame = frame->previous; + } if (frame == NULL) { continue; } |