summaryrefslogtreecommitdiffstats
path: root/Python/frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/frame.c')
-rw-r--r--Python/frame.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/frame.c b/Python/frame.c
index 206ecab..7c6705e 100644
--- a/Python/frame.c
+++ b/Python/frame.c
@@ -68,9 +68,13 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
f->f_frame = frame;
frame->owner = FRAME_OWNED_BY_FRAME_OBJECT;
assert(f->f_back == NULL);
- if (frame->previous != NULL) {
+ _PyInterpreterFrame *prev = frame->previous;
+ while (prev && _PyFrame_IsIncomplete(prev)) {
+ prev = prev->previous;
+ }
+ if (prev) {
/* Link PyFrameObjects.f_back and remove link through _PyInterpreterFrame.previous */
- PyFrameObject *back = _PyFrame_GetFrameObject(frame->previous);
+ PyFrameObject *back = _PyFrame_GetFrameObject(prev);
if (back == NULL) {
/* Memory error here. */
assert(PyErr_ExceptionMatches(PyExc_MemoryError));