[issue9417] Declaring a class creates circular references

Andrea Corbellini report at bugs.python.org
Thu Jul 29 18:32:55 CEST 2010


Andrea Corbellini <corbellini.andrea at gmail.com> added the comment:

This is an unwanted an unexpected behavior, so this is a bug by definition. If it's not easy to fix, it's a different matter.

However here's a proposed solution:

* for the __mro__: instead of using a tuple, use a new object that inherits from it. This new object should use weak reference for the first item and should return the real object (if available) only in __getitem__().

* __objclass__ can should become a property based on weak references.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9417>
_______________________________________


More information about the Python-bugs-list mailing list