Issue 13705: Raising exceptions from finally works better than advertised in the documentation (original) (raw)

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 "", line 2, in ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

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

Cheers,

SiniĊĦa