[Python-checkins] python/dist/src/Objects typeobject.c,2.236,2.237

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 13 Jun 2003 13:54:42 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv21979

Modified Files:
	typeobject.c 
Log Message:
- SF patch 751998 fixes an unwanted side effect of the previous fix
  for SF bug 742860 (the next item).


Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.236
retrieving revision 2.237
diff -C2 -d -r2.236 -r2.237
*** typeobject.c	11 Jun 2003 20:50:33 -0000	2.236
--- typeobject.c	13 Jun 2003 20:54:40 -0000	2.237
***************
*** 639,648 ****
  	_PyObject_GC_TRACK(self); /* We'll untrack for real later */
  
! 	/* Find the nearest base with a different tp_dealloc
! 	   and clear slots while we're at it */
  	base = type;
  	while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
- 		if (base->ob_size)
- 			clear_slots(base, self);
  		base = base->tp_base;
  		assert(base);
--- 639,645 ----
  	_PyObject_GC_TRACK(self); /* We'll untrack for real later */
  
! 	/* Find the nearest base with a different tp_dealloc */
  	base = type;
  	while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
  		base = base->tp_base;
  		assert(base);
***************
*** 650,654 ****
  
  	/* If we added a weaklist, we clear it.  Do this *before* calling
! 	   the finalizer (__del__) or clearing the instance dict. */
  	if (type->tp_weaklistoffset && !base->tp_weaklistoffset)
  		PyObject_ClearWeakRefs(self);
--- 647,653 ----
  
  	/* If we added a weaklist, we clear it.  Do this *before* calling
! 	   the finalizer (__del__), clearing slots, or clearing the instance
! 	   dict. */
! 
  	if (type->tp_weaklistoffset && !base->tp_weaklistoffset)
  		PyObject_ClearWeakRefs(self);
***************
*** 659,662 ****
--- 658,670 ----
  		if (self->ob_refcnt > 0)
  			goto endlabel;
+ 	}
+ 
+ 	/*  Clear slots up to the nearest base with a different tp_dealloc */
+ 	base = type;
+ 	while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
+ 		if (base->ob_size)
+ 			clear_slots(base, self);
+ 		base = base->tp_base;
+ 		assert(base);
  	}