diff options
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r-- | Objects/frameobject.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 4dd2183..81ad4cc 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -242,6 +242,7 @@ mark_stacks(PyCodeObject *code_obj, int len) break; } case JUMP_ABSOLUTE: + case JUMP_NO_INTERRUPT: j = get_arg(code, i); assert(j < len); if (stacks[j] == UNINITIALIZED && j < i) { @@ -625,7 +626,7 @@ frame_dealloc(PyFrameObject *f) { /* It is the responsibility of the owning generator/coroutine * to have cleared the generator pointer */ - assert(f->f_frame->generator == NULL); + assert(!f->f_frame->is_generator); if (_PyObject_GC_IS_TRACKED(f)) { _PyObject_GC_UNTRACK(f); @@ -698,8 +699,11 @@ frame_clear(PyFrameObject *f, PyObject *Py_UNUSED(ignored)) "cannot clear an executing frame"); return NULL; } - if (f->f_frame->generator) { - _PyGen_Finalize(f->f_frame->generator); + if (f->f_frame->is_generator) { + assert(!f->f_owns_frame); + size_t offset_in_gen = offsetof(PyGenObject, gi_iframe); + PyObject *gen = (PyObject *)(((char *)f->f_frame) - offset_in_gen); + _PyGen_Finalize(gen); } (void)frame_tp_clear(f); Py_RETURN_NONE; |