[Python-bugs-list] [ python-Bugs-516965 ] __del__ is not called correctly
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 13 Feb 2002 05:39:17 -0800
Bugs item #516965, was opened at 2002-02-13 05:39
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=516965&group_id=5470
Category: Python Interpreter Core
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Christoph Wiedemann (wiedeman)
Assigned to: Nobody/Anonymous (nobody)
Summary: __del__ is not called correctly
Initial Comment:
Hello,
I found some strange behaviour in classes which provide their own destructor. The python version is 2.2, compiled with gcc 3.0.1 running on linux (kernel 2.2.18, glibc 2.2). Following an interactive python session:
>>> class A:
... def __init__(self):
... print "const"
... def __del__(self):
... print "dest"
...
>>> a = A()
const
>>> a
dest
<__main__.A instance at 0x81c9894>
>>> del a
>>>
As you can see, the destructor is called, before the object is deleted. On a Python 2.1 version, the behaviour is correct (the destructor is called _after_ 'del a')
Bye,
Christoph Wiedemann
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=516965&group_id=5470