summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-07-12 19:57:15 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-07-12 19:57:15 (GMT)
commit84f1b1718da7fcbb8b8d255c166ef1ec0e03cd21 (patch)
tree27212e508563c40f28d06eb7938a1e07c6eca063 /Objects
parentb3593cada2ee83e1a7a8ee8b0905cbfed8396d3a (diff)
downloadcpython-84f1b1718da7fcbb8b8d255c166ef1ec0e03cd21.zip
cpython-84f1b1718da7fcbb8b8d255c166ef1ec0e03cd21.tar.gz
cpython-84f1b1718da7fcbb8b8d255c166ef1ec0e03cd21.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 3c724fd..97ccf01 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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);