[issue9417] Declaring a class creates circular references

Ray.Allen report at bugs.python.org
Thu Jul 29 17:03:02 CEST 2010

Ray.Allen <ysj.ray at gmail.com> added the comment:

This should not be a problem, I think. We cannot avoid such a circular reference. 

I believe the main reason of the circular reference is in MyClass.__mro__, this is a list and contains a reference to MyClass. You can add "__slots__ = []" to MyClass's class body to avoid __dict__(the one you mentioned) and another member which contains two more references to MyClass, but the __mro__ still contains the last reference to MyClass.

nosy: +ysj.ray

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list