__del__ ignores exception in 2.1?

David Bolen db3l at fitlinxx.com
Mon Aug 20 11:48:26 EDT 2001


Vassilis Virvilis <vasvir at iit.demokritos.gr> writes:

> Tom Good wrote:
> > 
> > From the Python 2.1 docs, section on __del__() :
> > 
> > "Warning: due to the precarious circumstances under which __del__()
> > methods are invoked, exceptions that occur during their execution are
> > ignored, and a warning is printed to sys.stderr instead."
> > 
> So it is documented behaviour, good. Thanks.

And BTW, documented at least as far back as 1.5.2 (probably earlier,
but that's the oldest stuff I've got handy).  There are also warnings
about the potential for globals to have already been deleted before
__del__ is called.  See section 3.3.1 in any version (at least back to
1.5.2) of the language reference.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list