summaryrefslogtreecommitdiff
path: root/Lib/idlelib/EditorWindow.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2013-08-04 15:39:03 -0400
committerTerry Jan Reedy <tjreedy@udel.edu>2013-08-04 15:39:03 -0400
commit95f34ab95959fa67d258043622744dae8519c5b2 (patch)
tree3fbbe3a8bf381438abfc71fd5613e883b55dc4cf /Lib/idlelib/EditorWindow.py
parentc86d7e989c98d57449263201e826a52c15102a64 (diff)
downloadcpython-git-95f34ab95959fa67d258043622744dae8519c5b2.tar.gz
Issue #18151: Replace remaining Idle 'open...close' pairs with 'with open'.
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r--Lib/idlelib/EditorWindow.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 24f133fa9b..c9ad364c2c 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -882,12 +882,9 @@ class EditorWindow(object):
"Load and update the recent files list and menus"
rf_list = []
if os.path.exists(self.recent_files_path):
- rf_list_file = open(self.recent_files_path,'r',
- encoding='utf_8', errors='replace')
- try:
+ with open(self.recent_files_path, 'r',
+ encoding='utf_8', errors='replace') as rf_list_file:
rf_list = rf_list_file.readlines()
- finally:
- rf_list_file.close()
if new_file:
new_file = os.path.abspath(new_file) + '\n'
if new_file in rf_list: