summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 11cc122..bcdb825 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();
}