]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
subtype_dealloc(): Simplified overly contorted retracking logic. With
authorTim Peters <tim.peters@gmail.com>
Thu, 13 Nov 2003 22:50:00 +0000 (22:50 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 13 Nov 2003 22:50:00 +0000 (22:50 +0000)
this change, I think subtype_dealloc is actually a smidgen less obscure
than it was in 2.3 -- we got rid of a negation in an "if" <wink>.

Objects/typeobject.c

index 032fa1822c310bbf486de58531f05480124faea8..e4eadb89a7652f77376d4ce25548175078ea461d 100644 (file)
@@ -690,12 +690,11 @@ subtype_dealloc(PyObject *self)
                }
        }
 
-       /* Finalize GC if the base doesn't do GC and we do */
-       _PyObject_GC_TRACK(self);
-       if (!PyType_IS_GC(base))
-               _PyObject_GC_UNTRACK(self);
-
-       /* Call the base tp_dealloc() */
+       /* Call the base tp_dealloc(); first retrack self if
+        * basedealloc knows about gc.
+        */
+       if (PyType_IS_GC(base))
+               _PyObject_GC_TRACK(self);
        assert(basedealloc);
        basedealloc(self);