diff options
-rw-r--r-- | Modules/_weakref.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_weakref.c b/Modules/_weakref.c index 399b4fe..5bdab4d 100644 --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -59,6 +59,7 @@ clear_weakref(PyWeakReference *self) if (self->wr_object != Py_None) { PyWeakReference **list = GET_WEAKREFS_LISTPTR(self->wr_object); + PyObject_GC_Fini((PyObject *)self); if (*list == self) *list = self->wr_next; self->wr_object = Py_None; @@ -78,7 +79,6 @@ static void weakref_dealloc(PyWeakReference *self) { clear_weakref(self); - PyObject_GC_Fini((PyObject *)self); self->wr_next = free_list; free_list = self; } |