diff Python/ceval.c @ 21270:97709fd8fda0 legacy-trunk

Fix for SF bug #489671 (Neil Norwitz): memory leak in test_richcmp. 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.
author Guido van Rossum <guido@python.org>
date Thu, 06 Dec 2001 21:28:18 +0000
parents e386f6e26a42
children de125792bfaa
line wrap: on
line diff
--- a/Python/ceval.c	Thu Dec 06 21:14:00 2001 +0000
+++ b/Python/ceval.c	Thu Dec 06 21:28:18 2001 +0000
@@ -2296,6 +2296,14 @@
 
 	} /* 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;