]> granicus.if.org Git - python/commitdiff
Fix for SF bug #489671 (Neil Norwitz): memory leak in test_richcmp.
authorGuido van Rossum <guido@python.org>
Thu, 6 Dec 2001 21:28:18 +0000 (21:28 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 6 Dec 2001 21:28:18 +0000 (21:28 +0000)
Had nothing to do with rich comparisons -- some stack cleanup code was
lost as a result of merging in Neil Schemenauer's generators patch.
Reinserted the stack cleanup code, skipping it when yielding.

Python/ceval.c

index 6def4229172c4da16a01d89a97e082eb278e73d1..29d70826f2b9a89dcedc67c4d9f991a6d3c84c23 100644 (file)
@@ -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;