__del__ doesn't work

Aahz aahz at pythoncraft.com
Sun Feb 15 16:07:59 EST 2004


In article <21064255.0402151141.51a38fed at posting.google.com>,
Peter Abel <PeterAbel at gmx.net> wrote:
>
>I have an application, which is an instance of a class with a deeply
>nested object hierarchy. Among others one method will be executed as a
>thread, which can be stopped.  Everything works fine except that when
>deleting the main instance - after the thread has been stopped - the
>__del__ method will not be carried out.

It's almost certainly the case that you've still got a reference to that
instance somewhere.  Try holding a binding to the instance; if
sys.getrefcount() returns >2, you know there's some other binding in
existence that you need to track down.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Argue for your limitations, and sure enough they're yours."  --Richard Bach



More information about the Python-list mailing list