Does python hate cathy?
gagsl-py2 at yahoo.com.ar
Tue Mar 25 06:49:01 CET 2008
En Tue, 25 Mar 2008 02:09:58 -0300, Edward A. Falk <falk at green.rahul.net>
> However, Adding
> self.myclass = Person
> to the __init__() method didn't stop the problem. I thought it might,
> then each of the objects would have held a reference to Person.
> Actually, I would
> have thought they'd hold a reference by merely existing, so is this not
> a bug?
Yes, they already have a reference (self.__class__). The problem is that
__del__ references Person by *name*, and that name is reset to None (like
all other module globals) as part of the interpreter shutdown sequence.
Using self.__class__ would avoid this particular bug, but in general, it's
better not to rely on __del__ at all.
See http://bugs.python.org/issue1513802 and
More information about the Python-list