[issue9417] Declaring a class creates circular references

Andrea Corbellini report at bugs.python.org
Thu Jul 29 16:19:46 CEST 2010


New submission from Andrea Corbellini <corbellini.andrea at gmail.com>:

Creating a class (either using the 'class' statement or using type()) creates a circular reference.

I've attached a script that simply demonstrates this. The problem is caused by the fact that MyClass.__dict__['__dict__'].__objclass__ is MyClass.

Although most of the times classes are never deleted when the interpreted exits, some programs (like the popular Django framework) create temporary classes. And this is a pain because you can't disable the garbage collector.

----------
components: Interpreter Core
files: test.py
messages: 111935
nosy: candrea
priority: normal
severity: normal
status: open
title: Declaring a class creates circular references
type: resource usage
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file18251/test.py

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


More information about the Python-bugs-list mailing list