]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#17614: IDLE no longer raises exception when quickly closing a file.
authorRoger Serwy <roger.serwy@gmail.com>
Wed, 3 Apr 2013 03:37:12 +0000 (22:37 -0500)
committerRoger Serwy <roger.serwy@gmail.com>
Wed, 3 Apr 2013 03:37:12 +0000 (22:37 -0500)
Lib/idlelib/PyShell.py
Misc/NEWS

index f2c9062c87d265bd527f8d556e9477b63de768cf..d144a51b725d9176b70f3f0811380a0ca4cb3f73 100644 (file)
@@ -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
index ab655ebe0915f2a8e023e4fe17fb5b57824455a3..75141c61062a11c956bb9fa199caf7266e8c06d6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #17614: IDLE no longer raises exception when quickly closing a file.
+
 - Issue #13163: Rename operands in smtplib.SMTP._get_socket to correct names;
   fixes otherwise misleading output in tracebacks and when when debug is on.