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 |