Commit f219a68d authored by Phillip J. Eby's avatar Phillip J. Eby

Fix a too-aggressive assert (see SF#1257960). Previously, gen_iternext

was never called during interpreter shutdown GC, so the f_back!=NULL
assertion was correct.  Now that generators get close()d during GC,
the assertion was being triggered because the generator close() was being
called as the top-level frame.  However, nothing actually is broken by
this; it's just that the condition was unexpected in previous Python
versions.
parent f504aca1
...@@ -82,7 +82,7 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc) ...@@ -82,7 +82,7 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc)
/* Don't keep the reference to f_back any longer than necessary. It /* Don't keep the reference to f_back any longer than necessary. It
* may keep a chain of frames alive or it could create a reference * may keep a chain of frames alive or it could create a reference
* cycle. */ * cycle. */
assert(f->f_back != NULL); assert(f->f_back == tstate->frame);
Py_CLEAR(f->f_back); Py_CLEAR(f->f_back);
/* If the generator just returned (as opposed to yielding), signal /* If the generator just returned (as opposed to yielding), signal
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment