diff Objects/typeobject.c @ 71299:9618303852da 2.7

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.
author Antoine Pitrou <solipsis@pitrou.net>
date Tue, 12 Jul 2011 22:04:20 +0200
parents 916838ace42a
children cd9eca1bf531
line wrap: on
line diff
--- a/Objects/typeobject.c	Sat Jul 09 21:29:36 2011 +0200
+++ b/Objects/typeobject.c	Tue Jul 12 22:04:20 2011 +0200
@@ -1013,6 +1013,8 @@
     assert(basedealloc);
     basedealloc(self);
 
+    PyType_Modified(type);
+
     /* Can't reference self beyond this point */
     Py_DECREF(type);