diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 83449df75df..41e746d78ca 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", "<>", "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 diff --git a/Misc/NEWS b/Misc/NEWS index b941ae0317a..8ffd9dee66b 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,8 @@ Core and Builtins Library ------- +- Issue #17614: IDLE no longer raises exception when quickly closing a file. + - Issue #6698: IDLE now opens just an editor window when configured to do so. - Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer