[issue13705] Raising exceptions from finally works better than advertised in the documentation
New submission from Sinisa Segvic <sinisa.segvic@fer.hr>: 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 ---------- assignee: docs@python components: Documentation messages: 150544 nosy: docs@python, ssegvic priority: normal severity: normal status: open title: Raising exceptions from finally works better than advertised in the documentation type: enhancement versions: Python 3.2 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13705> _______________________________________
Sinisa Segvic <sinisa.segvic@fer.hr> added the comment: Link to the documentation: http://docs.python.org/py3k/reference/compound_stmts.html#id2 ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13705> _______________________________________
Roundup Robot <devnull@psf.upfronthosting.co.za> added the comment: New changeset c39fbb24b3f4 by Benjamin Peterson in branch '3.2': exception support is correct now (closes #13705) http://hg.python.org/cpython/rev/c39fbb24b3f4 ---------- nosy: +python-dev resolution: -> fixed stage: -> committed/rejected status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13705> _______________________________________
participants (2)
-
Roundup Robot
-
Sinisa Segvic