This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ssegvic
Recipients docs@python, ssegvic
Date 2012-01-03.22:13:07
SpamBayes Score 7.035202e-10
Marked as misclassified No
Message-id <1325628788.79.0.655122317093.issue13705@psf.upfronthosting.co.za>
In-reply-to
Content
Hi,

The documentation says:
"""
If the finally clause raises another exception (...) the saved exception is lost. 
"""

This does not appear to be true. 
In the example below the backtrace shows both exceptions.

>>> import math
>>> try:
...   1/0
... finally:
...   math.sqrt(-1)
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
ValueError: math domain error

Cheers,

Siniša
History
Date User Action Args
2012-01-03 22:13:08ssegvicsetrecipients: + ssegvic, docs@python
2012-01-03 22:13:08ssegvicsetmessageid: <1325628788.79.0.655122317093.issue13705@psf.upfronthosting.co.za>
2012-01-03 22:13:08ssegviclinkissue13705 messages
2012-01-03 22:13:07ssegviccreate