summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-07-12 20:04:20 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-07-12 20:04:20 (GMT)
commit1616645a0032b45c935ec6bdbb1d46b3febf0827 (patch)
tree402f294b56e32dbc6066a176d5f609a18bc125dc /Objects
parent0504532c39ffdf6cb8e4b7b283da60027473a4a5 (diff)
downloadcpython-1616645a0032b45c935ec6bdbb1d46b3febf0827.zip
cpython-1616645a0032b45c935ec6bdbb1d46b3febf0827.tar.gz
cpython-1616645a0032b45c935ec6bdbb1d46b3febf0827.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 49c7e07..8326d07 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1013,6 +1013,8 @@ subtype_dealloc(PyObject *self)
assert(basedealloc);
basedealloc(self);
+ PyType_Modified(type);
+
/* Can't reference self beyond this point */
Py_DECREF(type);