New submission from Sinisa Segvic <sinisa.seg...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue13705>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to