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: Opening a file in IDLE causes a crash or hang
Type: behavior Stage: resolved
Components: IDLE Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: benjamin.peterson, ned.deily, python-dev, serhiy.storchaka
Priority: release blocker Keywords:

Created on 2013-10-28 22:29 by ned.deily, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg201586 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-10-28 22:29
Using current IDLE in 2.7 tip (as in 2.7.6rc1), selecting a file to open in the IDLE menu or on the command line cause IDLE to either (depending on the platform and invocation) crash or hang due to an uncaught exception in idlelib/IOBinding.py:

/usr/local/bin/idle2.7 a.py
Exception in Tkinter callback
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1470, in __call__
    return self.func(*args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/IOBinding.py", line 222, in open
    flist.open(filename)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/FileList.py", line 36, in open
    return self.EditorWindow(self, filename, key)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/PyShell.py", line 131, in __init__
    EditorWindow.__init__(self, *args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/EditorWindow.py", line 323, in __init__
    io.loadfile(filename)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/IOBinding.py", line 258, in loadfile
    chars = self.decode(chars)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/IOBinding.py", line 296, in decode
    enc = coding_spec(chars)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/IOBinding.py", line 129, in coding_spec
    for line in lst:
NameError: global name 'lst' is not defined

The culprit is 3d46ef0c62c5 for Issue18873 which did a faulty backport of a change from the 3.x branches.
msg201611 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-29 08:15
New changeset 7fde94ad5df4 by Serhiy Storchaka in branch '2.7':
Issue #19426: Fixed the opening of Python source file with specified encoding.
http://hg.python.org/cpython/rev/7fde94ad5df4
msg201612 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-29 08:17
Thank you Ned. Definitely IDLE needs more unit tests.
msg201658 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-29 19:31
New changeset e0475c44832f by Benjamin Peterson in branch '2.7':
backport #19426
http://hg.python.org/cpython/rev/e0475c44832f
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63625
2014-03-08 14:16:25r.david.murraylinkissue20869 superseder
2013-11-04 20:54:19ned.deilylinkissue19498 superseder
2013-10-29 19:31:31python-devsetmessages: + msg201658
2013-10-29 08:17:12serhiy.storchakasetstatus: open -> closed
type: behavior
messages: + msg201612

resolution: fixed
stage: needs patch -> resolved
2013-10-29 08:15:44python-devsetnosy: + python-dev
messages: + msg201611
2013-10-28 22:29:31ned.deilycreate