diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-08-12 18:40:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-12 18:40:49 (GMT) |
commit | 6fc90c11835f1af869a47724ab9742535b73fe7b (patch) | |
tree | dfd6beb3d5472d109def7ab58a0d7d7920505273 /Python | |
parent | 4abf84602f81da6719f761140dc909828350b45c (diff) | |
download | cpython-6fc90c11835f1af869a47724ab9742535b73fe7b.zip cpython-6fc90c11835f1af869a47724ab9742535b73fe7b.tar.gz cpython-6fc90c11835f1af869a47724ab9742535b73fe7b.tar.bz2 |
GH-95818: Skip incomplete frames in `PyThreadState_GetFrame` (GH-95886) (#95890)
(cherry picked from commit 1b46d118e6e72daa64b98cafddb406c68b419efa)
Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Mark Shannon <mark@hotpy.org>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pystate.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index df56c05..2e45856 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1255,10 +1255,14 @@ PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate) { assert(tstate != NULL); - if (tstate->cframe->current_frame == NULL) { + _PyInterpreterFrame *f = tstate->cframe->current_frame; + while (f && _PyFrame_IsIncomplete(f)) { + f = f->previous; + } + if (f == NULL) { return NULL; } - PyFrameObject *frame = _PyFrame_GetFrameObject(tstate->cframe->current_frame); + PyFrameObject *frame = _PyFrame_GetFrameObject(f); if (frame == NULL) { PyErr_Clear(); } |