]> granicus.if.org Git - python/commitdiff
Don't remove instance objects from the GC container set until we are
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>
Fri, 15 Sep 2000 18:57:21 +0000 (18:57 +0000)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>
Fri, 15 Sep 2000 18:57:21 +0000 (18:57 +0000)
they are dead.  Fixes bug #113812.

Objects/classobject.c

index 8bbd834cdbda1386bcb309b989b0bbf911ddc54d..d963fe13bbb9e7982dd7ceb257f3611d4ea0fa67 100644 (file)
@@ -490,7 +490,6 @@ instance_dealloc(register PyInstanceObject *inst)
 #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 @@ instance_dealloc(register PyInstanceObject *inst)
 #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 @@ instance_dealloc(register PyInstanceObject *inst)
        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);