Skip to content

Commit

Permalink
#17614: IDLE no longer raises exception when quickly closing a file.
Browse files Browse the repository at this point in the history
  • Loading branch information
serwy committed Apr 3, 2013
2 parents ed3a303 + d7c9d9c commit 0d28a61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Lib/idlelib/PyShell.py
Expand Up @@ -111,12 +111,13 @@ def __init__(self, *args):
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"),
Expand Down Expand Up @@ -233,6 +234,9 @@ def store_file_breaks(self):

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
Expand Down
2 changes: 2 additions & 0 deletions Misc/NEWS
Expand Up @@ -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
Expand Down

0 comments on commit 0d28a61

Please sign in to comment.