Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 122539e

Browse files
committed
#10974: IDLE no longer crashes if its recent files list includes files
with non-ASCII characters in their path names. (with approval of release manager for 3.2rc2)
1 parent feac624 commit 122539e

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Lib/idlelib/EditorWindow.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ def update_recent_files_list(self, new_file=None):
772772
"Load and update the recent files list and menus"
773773
rf_list = []
774774
if os.path.exists(self.recent_files_path):
775-
rf_list_file = open(self.recent_files_path,'r')
775+
rf_list_file = open(self.recent_files_path,'r',
776+
encoding='utf_8', errors='replace')
776777
try:
777778
rf_list = rf_list_file.readlines()
778779
finally:
@@ -790,7 +791,8 @@ def update_recent_files_list(self, new_file=None):
790791
rf_list = [path for path in rf_list if path not in bad_paths]
791792
ulchars = "1234567890ABCDEFGHIJK"
792793
rf_list = rf_list[0:len(ulchars)]
793-
rf_file = open(self.recent_files_path, 'w')
794+
rf_file = open(self.recent_files_path, 'w',
795+
encoding='utf_8', errors='replace')
794796
try:
795797
rf_file.writelines(rf_list)
796798
finally:

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Core and Builtins
1616
Library
1717
-------
1818

19+
- Issue #10974: IDLE no longer crashes if its recent files list includes files
20+
with non-ASCII characters in their path names.
21+
1922
- Have hashlib.algorithms_available and hashlib.algorithms_guaranteed both
2023
return sets instead of one returning a tuple and the other a frozenset.
2124

0 commit comments

Comments
 (0)