Terry J. Reedy added the comment:
I am on the fence as to whether this should be treated as a bug fix or
enhancement. Claudiu's pydev post gives this as the current
InteractiveInterpreter behavior.
------------------------------
>>> try:
... 1 / 0
... except ZeroDivisionError as exc:
... raise IOError from exc
...
Traceback (most recent call last):
File "<console>", line 4, in <module>
OSError
-----------------------------------
This certainly is not an exact emulation (given below), but is it severe enough
to be a bug, and moreover, would fixing it break code?
Again from Claudiu's post: with the patch.
---------------------------------
>>> try:
... 1 / 0
... except ZeroDivisionError as exc:
... raise IOError from exc
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
OSError
---------------------------------
I verified that this is exactly what 3.4.0 prints for interactive input,
But... the Idle Shell also prints the above, plus it adds (or received from the
user process) the offending code lines just as when the code is read from a
file.
...
File "<pyshell#0>", line 2, in <module>
1 / 0
ZeroDivisionError: division by zero
...
File "<pyshell#0>", line 4, in <module>
raise IOError from exc
OSError
Is there a reason the console interpreter cannot do the same? (Changing this
would be a different issue, but one this would depend on.)
----------
nosy: +terry.reedy
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17442>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com