summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/ceval.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index cf917db..ea5c537 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -152,6 +152,11 @@ gen_iternext(genobject *gen)
gen->running = 1;
result = eval_frame(f);
gen->running = 0;
+ /* The connection between this frame and its parent is over now, so
+ must NULL out f_back lest it get decref'ed when gen dies (note
+ that eval_frame sets f->f_back without bumping its refcount: we
+ never had a fully legit reference to it). */
+ f->f_back = NULL;
return result;
}