summaryrefslogtreecommitdiff
path: root/Objects/weakrefobject.c
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2007-01-23 23:21:22 +0000
committerBrett Cannon <bcannon@gmail.com>2007-01-23 23:21:22 +0000
commitf5bee30e30687447d9d532dc298ba0793beb4515 (patch)
tree429f3a16538dc9c832f2b04f74f9200f95121b23 /Objects/weakrefobject.c
parent6c5c502b914261ba333e98c4657a8d90cfbbe872 (diff)
downloadcpython-git-f5bee30e30687447d9d532dc298ba0793beb4515.tar.gz
Fix crasher for when an object's __del__ creates a new weakref to itself.
Patch only fixes new-style classes; classic classes still buggy. Closes bug #1377858. Already backported.
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r--Objects/weakrefobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 826f5710dc..a404f29ade 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -57,6 +57,9 @@ clear_weakref(PyWeakReference *self)
PyWeakref_GET_OBJECT(self));
if (*list == self)
+ /* If 'self' is the end of the list (and thus self->wr_next == NULL)
+ then the weakref list itself (and thus the value of *list) will
+ end up being set to NULL. */
*list = self->wr_next;
self->wr_object = Py_None;
if (self->wr_prev != NULL)