Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.5 (a2) traceback regression snarls Idle #67819

Closed
terryjreedy opened this issue Mar 10, 2015 · 8 comments
Closed

3.5 (a2) traceback regression snarls Idle #67819

terryjreedy opened this issue Mar 10, 2015 · 8 comments
Labels
release-blocker type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 23631
Nosy @gvanrossum, @birkenfeld, @terryjreedy, @ncoghlan, @larryhastings, @rbtcollins
Files
  • issue-23631-1.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2015-03-17.20:34:25.061>
    created_at = <Date 2015-03-10.21:25:28.627>
    labels = ['type-bug', 'release-blocker']
    title = '3.5 (a2) traceback regression snarls Idle'
    updated_at = <Date 2015-03-17.21:07:30.988>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2015-03-17.21:07:30.988>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-03-17.20:34:25.061>
    closer = 'rbcollins'
    components = []
    creation = <Date 2015-03-10.21:25:28.627>
    creator = 'terry.reedy'
    dependencies = []
    files = ['38503']
    hgrepos = []
    issue_num = 23631
    keywords = ['patch', '3.3regression']
    message_count = 8.0
    messages = ['237810', '237836', '238170', '238171', '238172', '238173', '238177', '238336']
    nosy_count = 7.0
    nosy_names = ['gvanrossum', 'georg.brandl', 'terry.reedy', 'ncoghlan', 'larry', 'rbcollins', 'python-dev']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue23631'
    versions = ['Python 3.5']

    @terryjreedy
    Copy link
    Member Author

    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.

    @terryjreedy terryjreedy added release-blocker type-bug An unexpected behavior, bug, or error labels Mar 10, 2015
    @gvanrossum
    Copy link
    Member

    Yeah, the stack track makes me suspect http://bugs.python.org/issue17911

    @rbtcollins
    Copy link
    Member

    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.

    @rbtcollins
    Copy link
    Member

    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.

    @rbtcollins
    Copy link
    Member

    And here is a patch, since this is a regression I'll apply it tomorrow (or sooner if it gets reviews :))

    @ncoghlan
    Copy link
    Contributor

    Patch looks good to me.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 16, 2015

    New changeset ea3cc128ce35 by Robert Collins in branch 'default':
    Issue bpo-23631: Fix traceback.format_list when a traceback has been mutated.
    https://hg.python.org/cpython/rev/ea3cc128ce35

    @rbtcollins
    Copy link
    Member

    Closing, though ideally Terry can confirm it is fully fixed for him.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    release-blocker type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants