Comment 2 for bug 239054

Revision history for this message
kilian (kilian.koepsell) wrote :

The __del__ method is not guaranteed to be executed when the object is still around at the time when python exits:
  http://docs.python.org/ref/customization.html
So, for python the behavior seems to be not well specified. (However, in this particular case, python seems to call the __del__ method).

In ipython, the situation is more complicated: If you run the above script in ipython, you will have a reference to the object a in your interactive session. You can access the object a and cannot be destroyed yet. If you add a line
  del a
to your script, also ipython wil release the object and the __del__ function will be called.