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.

classification
Title: Add tests regarding context of exception in a finally block
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: iritkatriel
Priority: normal Keywords: patch

Created on 2022-01-28 15:44 by iritkatriel, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30986 merged iritkatriel, 2022-01-28 15:45
Messages (2)
msg412003 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-28 15:44
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
msg412021 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-28 18:28
The documentation is fine: https://docs.python.org/3/library/exceptions.html#exception-context
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90721
2022-01-28 20:43:18iritkatrielsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-28 18:41:42iritkatrielsettitle: Add tests and documentation regarding context of exception in a finally block -> Add tests regarding context of exception in a finally block
2022-01-28 18:28:10iritkatrielsetmessages: + msg412021
2022-01-28 15:45:39iritkatrielsetkeywords: + patch
stage: patch review
pull_requests: + pull_request29170
2022-01-28 15:44:58iritkatrielcreate