Author terry.reedy
Recipients Claudiu.Popa, georg.brandl, pitrou, pjenvey, serhiy.storchaka, terry.reedy
Date 2014-04-23.23:45:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398296712.6.0.388894652558.issue17442@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2014-04-23 23:45:12terry.reedysetrecipients: + terry.reedy, georg.brandl, pitrou, pjenvey, Claudiu.Popa, serhiy.storchaka
2014-04-23 23:45:12terry.reedysetmessageid: <1398296712.6.0.388894652558.issue17442@psf.upfronthosting.co.za>
2014-04-23 23:45:12terry.reedylinkissue17442 messages
2014-04-23 23:45:12terry.reedycreate