[Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.36,2.126.4.37
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Thu, 29 May 2003 07:28:25 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv22112
Modified Files:
Tag: release22-maint
typeobject.c
Log Message:
Fix for SF 742911. We now clear the weakrefs *before* calling __del__
or emptying __dict__, just as we do for classic classes.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.126.4.36
retrieving revision 2.126.4.37
diff -C2 -d -r2.126.4.36 -r2.126.4.37
*** typeobject.c 21 May 2003 20:43:10 -0000 2.126.4.36
--- typeobject.c 29 May 2003 14:28:22 -0000 2.126.4.37
***************
*** 430,437 ****
destructor basedealloc;
! /* This exists so we can DECREF self->ob_type */
!
! if (call_finalizer(self) < 0)
! return;
/* Find the nearest base with a different tp_dealloc
--- 430,434 ----
destructor basedealloc;
! /* This function exists so we can DECREF self->ob_type */
/* Find the nearest base with a different tp_dealloc
***************
*** 446,449 ****
--- 443,453 ----
}
+ /* If we added weaklist, we clear it */
+ if (type->tp_weaklistoffset && !base->tp_weaklistoffset)
+ PyObject_ClearWeakRefs(self);
+
+ if (call_finalizer(self) < 0)
+ return;
+
/* If we added a dict, DECREF it */
if (type->tp_dictoffset && !base->tp_dictoffset) {
***************
*** 457,464 ****
}
}
-
- /* If we added weaklist, we clear it */
- if (type->tp_weaklistoffset && !base->tp_weaklistoffset)
- PyObject_ClearWeakRefs(self);
/* Finalize GC if the base doesn't do GC and we do */
--- 461,464 ----