Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in

#17442: code.InteractiveInterpreter doesn't display the exception cause

Can't Edit
Can't Publish+Mail
Start Review
4 years, 11 months ago by pjenvey
3 years, 10 months ago
jimjjewett, berker.peksag, pcmanticore
Georg, terry.reedy, AntoinePitrou, pjenvey, r.david.murray, Claudiu.Popa, devnull_psf.upfronthosting.co.za, berkerpeksag, storchaka

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Total comments: 4

Patch Set 4 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/code.rst View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
Lib/code.py View 1 2 3 1 chunk +22 lines, -12 lines 0 comments Download
Lib/test/test_code_module.py View 1 2 3 2 chunks +35 lines, -0 lines 0 comments Download


Total messages: 3
http://bugs.python.org/review/17442/diff/11318/Doc/library/code.rst File Doc/library/code.rst (right): http://bugs.python.org/review/17442/diff/11318/Doc/library/code.rst#newcode25 Doc/library/code.rst:25: interpreter when it comes to displaying exception causes. Slightly ...
4 years, 2 months ago #1
http://bugs.python.org/review/17442/diff/11318/Doc/library/code.rst File Doc/library/code.rst (right): http://bugs.python.org/review/17442/diff/11318/Doc/library/code.rst#newcode24 Doc/library/code.rst:24: :class:`InteractiveInterpreter` emulates properly the behaviour of the builtin Also, ...
3 years, 10 months ago #2
3 years, 10 months ago #3
File Lib/code.py (right):

Lib/code.py:143: for value, tb in traceback._iter_chain(*ei[1:]):
On 2014/04/24 03:50:29, Jim.J.Jewett wrote:
> What is the purpose of this?  It *looks* like it is just a fancy way of
> value=sys.last_value and tb=last_tb, but I'm pretty sure I'm missing something
> about the iteration.

The purpose if iteration is to generate the actual traceback that will be
printed, which includes the cause and the context of the exception, something
along these lines:

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>
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7