Closed
Description
We have been bitten a couple of times already if C extension types that implement the GC interface don't call PyObject_GC_UnTrack
in their tp_dealloc
slot. The last issue was #95045
Although this is technically not always an error (the tp_free
slot untracks the object from the GC), if the GC executes during the deallocator is possible that it will see an object with 0 reference count.
To avoid this in the future, we should add a warning if this happens so we can fix it within CPython