mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Issue #12149: Update the method cache after a type's dictionnary gets
cleared by the garbage collector. This fixes a segfault when an instance and its type get caught in a reference cycle, and the instance's deallocator calls one of the methods on the type (e.g. when subclassing IOBase). Diagnosis and patch by Davide Rizzo.
This commit is contained in:
commit
093c8e4bf0
4 changed files with 27 additions and 1 deletions
|
@ -967,6 +967,8 @@ subtype_dealloc(PyObject *self)
|
|||
assert(basedealloc);
|
||||
basedealloc(self);
|
||||
|
||||
PyType_Modified(type);
|
||||
|
||||
/* Can't reference self beyond this point */
|
||||
Py_DECREF(type);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue