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: 3.5 (a2) traceback regression snarls Idle
Type: behavior Stage: resolved
Components: Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, gvanrossum, larry, ncoghlan, python-dev, rbcollins, terry.reedy
Priority: release blocker Keywords: 3.3regression, patch

Created on 2015-03-10 21:25 by terry.reedy, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue-23631-1.patch rbcollins, 2015-03-16 01:59 review
Messages (8)
msg237810 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-03-10 21:25
3.5.0a2, my Win 7 and Guido's new Win laptop: error tracebacks are mangled in a way that makes Idle severely less functional, hence 'release blocker'.  First, the normal behavior.

Python 3.5.0a2 (v3.5.0a2:0337bd7ebcb6+, Mar  9 2015, 10:29:45) [MSC v.1900 64 bi
t (AMD64)] on win32
>>> 1/0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero

Idle 3.4.3 and previous give same, with the helpful addition of the code line ('1/0'), as in batch mode tracebacks, since it uses the traceback module.  But Idle 3.5.0a2 started from the installed icon gives

>>> 1/0
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 353, in runcode
    exec(code, self.locals)
  File "<pyshell#1>", line 1, in <module>
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 126, in main
    ret = method(*args, **kwargs)
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 365, in runcode
    print_exception()
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 216, in print_exception
    print_exc(typ, val, tb)
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 211, in print_exc
    traceback.print_list(tbe, file=efile)
  File "C:\Program Files\Python 3.5\lib\traceback.py", line 22, in print_list
    for item in StackSummary.from_list(extracted_list).format():
  File "C:\Program Files\Python 3.5\lib\traceback.py", line 370, in format
    frame.filename, frame.lineno, frame.name))
AttributeError: 'tuple' object has no attribute 'filename'

>>> ================================ RESTART ================================
>>> 


run.py (as should be more or less everything in idlelib) is identical in 3.4 and 3.5.  Idle started from a command line (py -3 -m idlelib) gives an even worse result.  The Idle Shell just shows

>>> 1/0
Traceback (most recent call last):
Traceback (most recent call last):

>>> ================================ RESTART ================================
>>> 


while the following appears in the command window (Command Prompt or PowerShell).

Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 353, in runcode
    exec(code, self.locals)
  File "<pyshell#0>", line 1, in <module>
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 126, in main
    ret = method(*args, **kwargs)
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 365, in runcode
    print_exception()
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 216, in print_exception
    print_exc(typ, val, tb)
  File "C:\Program Files\Python 3.5\lib\idlelib\run.py", line 211, in print_exc
    traceback.print_list(tbe, file=efile)
  File "C:\Program Files\Python 3.5\lib\traceback.py", line 22, in print_list
    for item in StackSummary.from_list(extracted_list).format():
  File "C:\Program Files\Python 3.5\lib\traceback.py", line 370, in format
    frame.filename, frame.lineno, frame.name))
AttributeError: 'tuple' object has no attribute 'filename'
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\idlelib\rpc.py", line 359, in pollpacket
    s = self.sock.recv(BUFSIZE)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the r

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\idlelib\rpc.py", line 432, in pollresponse
    message = self.pollmessage(wait)
  File "C:\Program Files\Python 3.5\lib\idlelib\rpc.py", line 384, in pollmessage
    packet = self.pollpacket(wait)
  File "C:\Program Files\Python 3.5\lib\idlelib\rpc.py", line 361, in pollpacket
    raise EOFError
EOFError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\idlelib\PyShell.py", line 565, in poll_subprocess
    response = clt.pollresponse(self.active_seq, wait=0.05)
  File "C:\Program Files\Python 3.5\lib\idlelib\rpc.py", line 436, in pollresponse
    self.handle_EOF()
  File "C:\Program Files\Python 3.5\lib\idlelib\PyShell.py", line 383, in handle_EOF
    raise EOFError
EOFError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
ValueError: invalid literal for int() with base 10: '??'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\tkinter\__init__.py", line 1534, in __call__
    args = self.subst(*args)
  File "C:\Program Files\Python 3.5\lib\tkinter\__init__.py", line 1252, in _substitute
    e.num = getint_event(b)
  File "C:\Program Files\Python 3.5\lib\tkinter\__init__.py", line 1231, in getint_event
    return int(s)
SystemError: result with error in PyObject_Call


This needs to be checked on another OS, but the traceback problem does not strike me as Windows-specific.
msg237836 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2015-03-11 02:05
Yeah, the stack track makes me suspect http://bugs.python.org/issue17911
msg238170 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-03-16 01:31
I suspect that this is due to a list being passed in that wasn't created by traceback, in the older tuple-only format. That was meant to work, but possibly is being short circuited somewhere. Shall fix asap.
msg238171 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-03-16 01:48
Ah, idle is being somewhat naughty. It's taking the original traceback and then mangling the contents in-place, which is preserving the type information, and throwing off StackSummary.from_list. We can and should make the new code deal with this in case other folk are doing it. In future it would be good to subsume cleanup_traceback's guts into the traceback module, but we don't need to do that now.
msg238172 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-03-16 01:59
And here is a patch, since this is a regression I'll apply it tomorrow (or sooner if it gets reviews :))
msg238173 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2015-03-16 02:02
Patch looks good to me.
msg238177 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-16 02:27
New changeset ea3cc128ce35 by Robert Collins in branch 'default':
Issue #23631: Fix traceback.format_list when a traceback has been mutated.
https://hg.python.org/cpython/rev/ea3cc128ce35
msg238336 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-03-17 20:34
Closing, though ideally Terry can confirm it is fully fixed for him.
History
Date User Action Args
2022-04-11 14:58:13adminsetgithub: 67819
2015-03-17 21:07:30berker.peksagsetstage: needs patch -> resolved
2015-03-17 20:34:25rbcollinssetstatus: open -> closed
resolution: fixed
messages: + msg238336
2015-03-16 02:27:34python-devsetnosy: + python-dev
messages: + msg238177
2015-03-16 02:02:09ncoghlansetmessages: + msg238173
2015-03-16 01:59:20rbcollinssetfiles: + issue-23631-1.patch
keywords: + patch
messages: + msg238172
2015-03-16 01:48:54rbcollinssetmessages: + msg238171
2015-03-16 01:31:22rbcollinssetmessages: + msg238170
2015-03-11 02:05:26gvanrossumsetnosy: + gvanrossum
messages: + msg237836
2015-03-10 22:34:20berker.peksagsetnosy: + rbcollins
2015-03-10 21:25:28terry.reedycreate