summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-09-05 17:39:57 (GMT)
committerBenjamin Peterson <benjamin@python.org>2016-09-05 17:39:57 (GMT)
commitbdddb11b0efd438696b5fa3e75f323248c22af7d (patch)
tree4f89755fd6da8eedb2238da80972e602208b9cee /Objects
parent80109d3351d2d1758caa2ff37bc4b69cc91a2fbe (diff)
downloadcpython-bdddb11b0efd438696b5fa3e75f323248c22af7d.zip
cpython-bdddb11b0efd438696b5fa3e75f323248c22af7d.tar.gz
cpython-bdddb11b0efd438696b5fa3e75f323248c22af7d.tar.bz2
clear out f_gen during generator finalization (closes #27812)
Patch from Armin Rigo.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/genobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index a9ea5c2..01c59c2 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -71,7 +71,10 @@ gen_dealloc(PyGenObject *gen)
return; /* resurrected. :( */
_PyObject_GC_UNTRACK(self);
- Py_CLEAR(gen->gi_frame);
+ if (gen->gi_frame != NULL) {
+ gen->gi_frame->f_gen = NULL;
+ Py_CLEAR(gen->gi_frame);
+ }
Py_CLEAR(gen->gi_code);
Py_CLEAR(gen->gi_name);
Py_CLEAR(gen->gi_qualname);