[Python-checkins] CVS: python/dist/src/Python ceval.c,2.250,2.251

Tim Peters tim_one@users.sourceforge.net
Tue, 19 Jun 2001 23:57:34 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv31108/python/dist/src/Python

Modified Files:
	ceval.c 
Log Message:
gen_iternext():  repair subtle refcount problem.
NeilS, please check!  This came from staring at your genbug.py, but I'm
not sure it plugs all possible holes.  Without this, I caught a
frameobject refcount going negative, and it was also the cause (in debug
build) of _Py_ForgetReference's attempt to forget an object with already-
NULL _ob_prev and _ob_next pointers -- although I'm still not entirely
sure how!  Part of the difficulty is that frameobjects are stored on a
free list that gets recycled very quickly, so if there's a stray pointer
to one of them it never looks like an insane frameobject (never goes
trough the free() mangling MS debug forces, etc).


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.250
retrieving revision 2.251
diff -C2 -r2.250 -r2.251
*** ceval.c	2001/06/20 00:39:28	2.250
--- ceval.c	2001/06/20 06:57:32	2.251
***************
*** 153,156 ****
--- 153,161 ----
  	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;
  }