STINNER Victor added the comment: > * Somehow, notify Foo that Meta has a reference to its cache, so Foo is able > to invalidate Meta cache
This was implemented when the type cache was implemented in Python 2.6, but only for explicit subclasses. PyType_Modified() iterates on tp_subclasses. PyType_Ready() updates tp_subclasses: it stores a weak reference to sub classes in each base class. I understand that, if we want to implement this feature, type_mro_modified() should be modified to add a backward reference in each base class of the MRO. type_mro_modified() is called when a type is defined, but also when type.__bases__ is explicitly modified. It would require to add a new slot to types, and so increase a little bit the memory usage, and slow down the creation of a type, and type.__bases__ (slow down: probably negligible, O(1) since the existing tp_subclasses uses a dict). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28866> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com