summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorRoger Serwy <roger.serwy@gmail.com>2013-04-03 03:39:39 (GMT)
committerRoger Serwy <roger.serwy@gmail.com>2013-04-03 03:39:39 (GMT)
commit0d28a61d233c02c458c8b4a25613be2f4979331e (patch)
treedad02b93b8082b204d950df105adb570392e52bf /Lib/idlelib
parented3a303548ba08aac44176b4566efa2f3bc0db66 (diff)
parentd7c9d9cdcdc179a0c9a458c70f814cd9db024e5d (diff)
downloadcpython-0d28a61d233c02c458c8b4a25613be2f4979331e.zip
cpython-0d28a61d233c02c458c8b4a25613be2f4979331e.tar.gz
cpython-0d28a61d233c02c458c8b4a25613be2f4979331e.tar.bz2
#17614: IDLE no longer raises exception when quickly closing a file.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/PyShell.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 83449df..41e746d 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -111,12 +111,13 @@ class PyShellEditorWindow(EditorWindow):
self.breakpointPath = os.path.join(idleConf.GetUserCfgDir(),
'breakpoints.lst')
# whenever a file is changed, restore breakpoints
- if self.io.filename: self.restore_file_breaks()
def filename_changed_hook(old_hook=self.io.filename_change_hook,
self=self):
self.restore_file_breaks()
old_hook()
self.io.set_filename_change_hook(filename_changed_hook)
+ if self.io.filename:
+ self.restore_file_breaks()
rmenu_specs = [
("Cut", "<<cut>>", "rmenu_check_cut"),
@@ -233,6 +234,9 @@ class PyShellEditorWindow(EditorWindow):
def restore_file_breaks(self):
self.text.update() # this enables setting "BREAK" tags to be visible
+ if self.io is None:
+ # can happen if IDLE closes due to the .update() call
+ return
filename = self.io.filename
if filename is None:
return