diff Objects/classobject.c @ 14605:8ad9bd9ca60c legacy-trunk

Don't remove instance objects from the GC container set until we are they are dead. Fixes bug #113812.
author Neil Schemenauer <nascheme@enme.ucalgary.ca>
date Fri, 15 Sep 2000 18:57:21 +0000
parents 6f6f965c5e2d
children 3d6fe64bcd21
line wrap: on
line diff
--- a/Objects/classobject.c	Fri Sep 15 18:55:58 2000 +0000
+++ b/Objects/classobject.c	Fri Sep 15 18:57:21 2000 +0000
@@ -490,7 +490,6 @@
 #ifdef Py_TRACE_REFS
 	extern long _Py_RefTotal;
 #endif
-	PyObject_GC_Fini(inst);
 	/* Call the __del__ method if it exists.  First temporarily
 	   revive the object and save the current exception, if any. */
 #ifdef Py_TRACE_REFS
@@ -523,7 +522,6 @@
 #ifdef COUNT_ALLOCS
 		inst->ob_type->tp_free--;
 #endif
-		PyObject_GC_Init((PyObject *)inst);
 		return; /* __del__ added a reference; don't delete now */
 	}
 #ifdef Py_TRACE_REFS
@@ -535,6 +533,7 @@
 	inst->ob_type = NULL;
 #endif
 #endif /* Py_TRACE_REFS */
+	PyObject_GC_Fini(inst);
 	Py_DECREF(inst->in_class);
 	Py_XDECREF(inst->in_dict);
 	inst = (PyInstanceObject *) PyObject_AS_GC(inst);