summaryrefslogtreecommitdiff
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 6def422917..29d70826f2 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2296,6 +2296,14 @@ eval_frame(PyFrameObject *f)
} /* main loop */
+ if (why != WHY_YIELD) {
+ /* Pop remaining stack entries -- but when yielding */
+ while (!EMPTY()) {
+ v = POP();
+ Py_XDECREF(v);
+ }
+ }
+
if (why != WHY_RETURN && why != WHY_YIELD)
retval = NULL;