Skip to content

Commit 8f9a177

Browse files
Address review: replace resurrection pattern with assert
1 parent c4e7084 commit 8f9a177

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

Objects/typeobject.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6879,12 +6879,10 @@ type_dealloc(PyObject *self)
68796879
// Assert this is a heap-allocated type object
68806880
_PyObject_ASSERT((PyObject *)type, type->tp_flags & Py_TPFLAGS_HEAPTYPE);
68816881

6882-
// Notify type watchers before teardown, using the same resurrection
6883-
// pattern that dict_dealloc() uses. The type object is still fully
6882+
// Notify type watchers before teardown. The type object is still fully
68846883
// intact at this point (dict, bases, mro, name are all valid), so
68856884
// callbacks can safely inspect it.
68866885
if (type->tp_watched) {
6887-
_PyObject_ResurrectStart(self);
68886886
PyInterpreterState *interp = _PyInterpreterState_GET();
68896887
int bits = type->tp_watched;
68906888
int i = 0;
@@ -6902,9 +6900,7 @@ type_dealloc(PyObject *self)
69026900
i++;
69036901
bits >>= 1;
69046902
}
6905-
if (_PyObject_ResurrectEnd(self)) {
6906-
return; // callback resurrected the object
6907-
}
6903+
assert(Py_REFCNT(self) == 0);
69086904
}
69096905

69106906
_PyObject_GC_UNTRACK(type);

0 commit comments

Comments
 (0)