summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-09-13 10:56:27 (GMT)
committerGitHub <noreply@github.com>2022-09-13 10:56:27 (GMT)
commitc4cf745c723f19dbc5b304bfb21cf77ac9aa40b8 (patch)
tree97b44c31187781dddae878274c4e1bf316c4ba2c /Python
parent8238fa91c175243061120856b14d735e8a740fa0 (diff)
downloadcpython-c4cf745c723f19dbc5b304bfb21cf77ac9aa40b8.zip
cpython-c4cf745c723f19dbc5b304bfb21cf77ac9aa40b8.tar.gz
cpython-c4cf745c723f19dbc5b304bfb21cf77ac9aa40b8.tar.bz2
GH-96754: Check whether the interpreter frame is complete before creating frame object. (GH-96776) (#96787)
(cherry picked from commit 12c5f328d2479ac3432df5e266adc4e59adeabfe) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Mark Shannon <mark@hotpy.org>
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c8
-rw-r--r--Python/pystate.c3
2 files changed, 8 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 66fa2ea..a5dfacf 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5747,9 +5747,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 12ebbe3..4250653 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1391,6 +1391,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;
}