PyTypeObject *type, *base;
destructor basedealloc;
- /* This exists so we can DECREF self->ob_type */
-
- if (call_finalizer(self) < 0)
- return;
+ /* This function exists so we can DECREF self->ob_type */
/* Find the nearest base with a different tp_dealloc
and clear slots while we're at it */
assert(base);
}
+ /* 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) {
PyObject **dictptr = _PyObject_GetDictPtr(self);
}
}
- /* 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 */
if (PyType_IS_GC(type) && !PyType_IS_GC(base))
_PyObject_GC_UNTRACK(self);