mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
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.
This commit is contained in:
parent
6c5c502b91
commit
f5bee30e30
5 changed files with 34 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue