[New-bugs-announce] [issue46563] Add tests and documentation regarding context of exception in a finally block

Irit Katriel report at bugs.python.org
Fri Jan 28 10:44:58 EST 2022


New submission from Irit Katriel <iritkatriel at gmail.com>:

This behavior (that the OSError has the ValueError as context) should be tested and documented: 


>>> try:
...   raise TypeError(1)
... except:
...   raise ValueError(2)
... finally:
...   raise OSError(3)
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: 1

During handling of the above exception, another exception occurred:

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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
OSError: 3

----------
components: Interpreter Core
messages: 412003
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Add tests and documentation regarding context of exception in a finally block
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46563>
_______________________________________


More information about the New-bugs-announce mailing list