]> granicus.if.org Git - python/commitdiff
#10974: IDLE no longer crashes if its recent files list includes files
authorNed Deily <nad@acm.org>
Mon, 24 Jan 2011 21:46:44 +0000 (21:46 +0000)
committerNed Deily <nad@acm.org>
Mon, 24 Jan 2011 21:46:44 +0000 (21:46 +0000)
        with non-ASCII characters in their path names.

        (with approval of release manager for 3.2rc2)

Lib/idlelib/EditorWindow.py
Misc/NEWS

index 7b7eb3939dc546c5019247347161cd44c6e64d3d..938a656244ff0ce6ce1cacac159eaaae1d8e122f 100644 (file)
@@ -772,7 +772,8 @@ 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')
+            rf_list_file = open(self.recent_files_path,'r',
+                                encoding='utf_8', errors='replace')
             try:
                 rf_list = rf_list_file.readlines()
             finally:
@@ -790,7 +791,8 @@ class EditorWindow(object):
         rf_list = [path for path in rf_list if path not in bad_paths]
         ulchars = "1234567890ABCDEFGHIJK"
         rf_list = rf_list[0:len(ulchars)]
-        rf_file = open(self.recent_files_path, 'w')
+        rf_file = open(self.recent_files_path, 'w',
+                        encoding='utf_8', errors='replace')
         try:
             rf_file.writelines(rf_list)
         finally:
index b6b953e46c486ce772318c36abc961daedfb621c..07f493ad9a6e56a2e73a6944eaaeaa5cbfd05ecc 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -16,6 +16,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #10974: IDLE no longer crashes if its recent files list includes files
+  with non-ASCII characters in their path names.
+
 - Have hashlib.algorithms_available and hashlib.algorithms_guaranteed both
   return sets instead of one returning a tuple and the other a frozenset.