Skip to content

Commit f89ddfd

Browse files
committed
Go back to asserting refcnt == 0
1 parent 2d81b6b commit f89ddfd

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Objects/object.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3077,17 +3077,14 @@ _PyTrash_thread_destroy_chain(PyThreadState *tstate)
30773077
if (tagged_ptr & 1) {
30783078
_PyObject_GC_TRACK(op);
30793079
}
3080-
/* It is possible that the object has been accessed through
3081-
* a weak ref, so only free if refcount == 0) */
3082-
if (Py_REFCNT(op) == 0) {
3083-
/* Call the deallocator directly. This used to try to
3084-
* fool Py_DECREF into calling it indirectly, but
3085-
* Py_DECREF was already called on this object, and in
3086-
* assorted non-release builds calling Py_DECREF again ends
3087-
* up distorting allocation statistics.
3088-
*/
3089-
(*dealloc)(op);
3090-
}
3080+
/* Call the deallocator directly. This used to try to
3081+
* fool Py_DECREF into calling it indirectly, but
3082+
* Py_DECREF was already called on this object, and in
3083+
* assorted non-release builds calling Py_DECREF again ends
3084+
* up distorting allocation statistics.
3085+
*/
3086+
_PyObject_ASSERT(op, Py_REFCNT(op) == 0);
3087+
(*dealloc)(op);
30913088
}
30923089
}
30933090

0 commit comments

Comments
 (0)