aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/frame.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/frame.c b/Python/frame.c
index 05a8cffcb8a..96566de63a7 100644
--- a/Python/frame.c
+++ b/Python/frame.c
@@ -70,6 +70,13 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
frame = (_PyInterpreterFrame *)f->_f_frame_data;
f->f_frame = frame;
frame->owner = FRAME_OWNED_BY_FRAME_OBJECT;
+ if (_PyFrame_IsIncomplete(frame)) {
+ // This may be a newly-created generator or coroutine frame. Since it's
+ // dead anyways, just pretend that the first RESUME ran:
+ PyCodeObject *code = frame->f_code;
+ frame->prev_instr = _PyCode_CODE(code) + code->_co_firsttraceable;
+ }
+ assert(!_PyFrame_IsIncomplete(frame));
assert(f->f_back == NULL);
_PyInterpreterFrame *prev = frame->previous;
while (prev && _PyFrame_IsIncomplete(prev)) {