__del__ ignores exception in 2.1?

Alex Martelli aleaxit at yahoo.com
Fri Aug 17 11:24:51 EDT 2001


"Vassilis Virvilis" <vasvir at iit.demokritos.gr> wrote in message
news:3B7D186A.A3E3FB9E at iit.demokritos.gr...
    ...
> Exception exceptions.NameError: "global name 'badsnake' is not defined" in
> <method bar.__del__ of bar instance at 0x80cfa1c> ignored
> It continues
>
> Why? Shouldn't the exception make python abort?

Python prefers to ignores exceptions (possibly with a warning)
in cases where they couldn't be handled, such as in __del__
special-methods, rather than aborting (as is more typical in
C++, e.g. when an exception is raised while another one is
propagating).  This isn't new in 2.1 -- it's been that way for
quite a while.


Alex






More information about the Python-list mailing list