summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRoger Serwy <roger.serwy@gmail.com>2013-04-03 03:37:12 (GMT)
committerRoger Serwy <roger.serwy@gmail.com>2013-04-03 03:37:12 (GMT)
commitd7c9d9cdcdc179a0c9a458c70f814cd9db024e5d (patch)
tree4570f82c90ac474a97859044b4d9e53dc5e19e8d /Lib
parentc993a1948043af043bec8e8230abd68200a863b1 (diff)
downloadcpython-d7c9d9cdcdc179a0c9a458c70f814cd9db024e5d.zip
cpython-d7c9d9cdcdc179a0c9a458c70f814cd9db024e5d.tar.gz
cpython-d7c9d9cdcdc179a0c9a458c70f814cd9db024e5d.tar.bz2
#17614: IDLE no longer raises exception when quickly closing a file.
Diffstat (limited to 'Lib')
-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 f2c9062..d144a51 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -116,12 +116,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"),
@@ -237,6 +238,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