mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
gh-95324: Emit a warning if an object doesn't call PyObject_GC_UnTrack during deallocation in debug mode (#95325)
This commit is contained in:
parent
2833f3798d
commit
f40bc7fa49
8 changed files with 18 additions and 2 deletions
|
|
@ -57,6 +57,7 @@ lock_traverse(lockobject *self, visitproc visit, void *arg)
|
|||
static void
|
||||
lock_dealloc(lockobject *self)
|
||||
{
|
||||
PyObject_GC_UnTrack(self);
|
||||
if (self->in_weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs((PyObject *) self);
|
||||
}
|
||||
|
|
@ -333,6 +334,7 @@ rlock_traverse(rlockobject *self, visitproc visit, void *arg)
|
|||
static void
|
||||
rlock_dealloc(rlockobject *self)
|
||||
{
|
||||
PyObject_GC_UnTrack(self);
|
||||
if (self->in_weakreflist != NULL)
|
||||
PyObject_ClearWeakRefs((PyObject *) self);
|
||||
/* self->rlock_lock can be NULL if PyThread_allocate_lock() failed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue