summaryrefslogtreecommitdiff
path: root/Modules/_weakref.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-03-22 18:05:30 +0000
committerFred Drake <fdrake@acm.org>2001-03-22 18:05:30 +0000
commit82f1480d63a43c2007460e8f186aba8d0fc4ce38 (patch)
tree6edee1ca518aa691b911855bc87e3765f9cd7ee4 /Modules/_weakref.c
parent2c7735593766e948036c2c714b4b2c41542f9743 (diff)
downloadcpython-git-82f1480d63a43c2007460e8f186aba8d0fc4ce38.tar.gz
Inform the cycle-detector that the a weakref object no longer needs to be
tracked as soon as it is clear; this can decrease the number of roots for the cycle detector sooner rather than later in applications which hold on to weak references beyond the time of the invalidation.
Diffstat (limited to 'Modules/_weakref.c')
-rw-r--r--Modules/_weakref.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_weakref.c b/Modules/_weakref.c
index 399b4fe67b..5bdab4dbc0 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;
}