[Python-checkins] CVS: python/dist/src/Python ceval.c,2.295,2.296

Guido van Rossum gvanrossum@users.sourceforge.net
2001年12月06日 13:28:21 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv3446
Modified Files:
	ceval.c 
Log Message:
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.
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.295
retrieving revision 2.296
diff -C2 -d -r2.295 -r2.296
*** ceval.c	2001年12月06日 14:09:56	2.295
--- ceval.c	2001年12月06日 21:28:18	2.296
***************
*** 2297,2300 ****
--- 2297,2308 ----
 	} /* 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;

AltStyle によって変換されたページ (->オリジナル) /