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.

Title: IDLE - quickly closing a large file triggers a traceback
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.3, Python 3.4, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: roger.serwy Nosy List: ned.deily, orsenthil, python-dev, roger.serwy
Priority: high Keywords: patch

Created on 2013-04-02 03:42 by roger.serwy, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue17614.patch roger.serwy, 2013-04-02 04:05 review
issue17614_rev1.patch roger.serwy, 2013-04-03 02:01 review
Messages (8)
msg185802 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-02 03:42
Using the generation program from #17613 triggers the following traceback:

Traceback (most recent call last):
  File "/usr/bin/idle", line 5, in <module>
  File "/usr/lib/python3.3/idlelib/", line 1431, in main
    if is None:
  File "/usr/lib/python3.3/idlelib/", line 36, in open
    edit = self.EditorWindow(self, filename, key)
  File "/usr/lib/python3.3/idlelib/", line 113, in __init__
    if self.restore_file_breaks()
  File "/usr/lib/python3.3/idlelib/", line 229, in restore_file_breaks
    filename =
AttributeError: 'NoneType' object has no attribute 'filename'
msg185803 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-02 03:44
I misworded the first sentence. It should have read: "Using as generated by the program in #17613 can trigger the following traceback when quickly closing the editor."

Other large files can be used to trigger the bug as well, like Lib/
msg185804 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-02 04:05
Like #17613, the root cause is a call to .update() in Lib/idlelib/ .restore_file_breaks().

The attached patch fixes the issue.
msg185811 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-04-02 04:50
Is there a better way to reproduce the error in the first place.
On 2.7 tip,
./python -m idelib.idle
Opened and closed and - and could not reproduce the error. If I could, I could have tested the patch.
msg185815 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-02 04:59
I forgot to specify that the race condition gets triggered by pressing Alt-F4 the moment the IDLE editor window appears. 

I am reliably reproducing the error using the Konsole terminal under Arch Linux.
msg185820 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-04-02 06:57
msg185879 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-03 02:01
Updated patch based on Ezio's comments. Thank you, Ezio!

Senthil, I wish I had a Mac to test against. I am able to trigger the bug on Win7 with 3.3.

Without objection, I will commit the patch in the upcoming hours.
msg185881 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-04-03 03:41
New changeset 1e5e497ee33b by Roger Serwy in branch '2.7':
#17614: IDLE no longer raises exception when quickly closing a file.

New changeset d759b7bc9785 by Roger Serwy in branch '3.3':
#17614: IDLE no longer raises exception when quickly closing a file.

New changeset 578edbe38f0a by Roger Serwy in branch 'default':
#17614: merge with 3.3.
Date User Action Args
2022-04-11 14:57:43adminsetgithub: 61814
2014-07-23 20:06:37serhiy.storchakalinkissue16547 superseder
2013-04-03 03:45:32roger.serwysetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2013-04-03 03:41:58python-devsetnosy: + python-dev
messages: + msg185881
2013-04-03 02:01:48roger.serwysetfiles: + issue17614_rev1.patch
assignee: roger.serwy
messages: + msg185879
2013-04-02 09:45:18ezio.melottisetpriority: critical -> high
versions: - Python 3.2
2013-04-02 06:59:19ned.deilysetstage: patch review -> commit review
2013-04-02 06:57:32ned.deilysetnosy: + ned.deily
messages: + msg185820
2013-04-02 04:59:27roger.serwysetmessages: + msg185815
2013-04-02 04:50:42orsenthilsetnosy: + orsenthil
messages: + msg185811
2013-04-02 04:05:01roger.serwysetfiles: + issue17614.patch
keywords: + patch
messages: + msg185804

stage: patch review
2013-04-02 03:44:41roger.serwysetmessages: + msg185803
2013-04-02 03:42:40roger.serwycreate