Skip to content

Commit 0bd743c

Browse files
committed
subtype_dealloc(): Simplified overly contorted retracking logic. With
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>.
1 parent f7f9e99 commit 0bd743c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Objects/typeobject.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,11 @@ subtype_dealloc(PyObject *self)
690690
}
691691
}
692692

693-
/* Finalize GC if the base doesn't do GC and we do */
694-
_PyObject_GC_TRACK(self);
695-
if (!PyType_IS_GC(base))
696-
_PyObject_GC_UNTRACK(self);
697-
698-
/* Call the base tp_dealloc() */
693+
/* Call the base tp_dealloc(); first retrack self if
694+
* basedealloc knows about gc.
695+
*/
696+
if (PyType_IS_GC(base))
697+
_PyObject_GC_TRACK(self);
699698
assert(basedealloc);
700699
basedealloc(self);
701700

0 commit comments

Comments
 (0)