diff Objects/typeobject.c @ 71297:cd40ea4087b0 3.2

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 21:57:15 +0200
parents 72e93f0ebe36
children 8b52ac4a0c9f 5992cbbedf59
line wrap: on
line diff
--- a/Objects/typeobject.c	Mon Jul 11 01:39:19 2011 +0200
+++ b/Objects/typeobject.c	Tue Jul 12 21:57:15 2011 +0200
@@ -967,6 +967,8 @@
     assert(basedealloc);
     basedealloc(self);
 
+    PyType_Modified(type);
+
     /* Can't reference self beyond this point */
     Py_DECREF(type);