]> granicus.if.org Git - python/commitdiff
Merged revisions 88174 via svnmerge from
authorNed Deily <nad@acm.org>
Mon, 24 Jan 2011 22:22:06 +0000 (22:22 +0000)
committerNed Deily <nad@acm.org>
Mon, 24 Jan 2011 22:22:06 +0000 (22:22 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88174 | ned.deily | 2011-01-24 13:46:44 -0800 (Mon, 24 Jan 2011) | 6 lines

  #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)
........

Lib/idlelib/EditorWindow.py
Misc/NEWS

index 20a2b26bafc4049b2e816e380efdcab8abab9f82..ab75f3ad649c1347af1ee4d56dc2a14e44805846 100644 (file)
@@ -773,7 +773,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:
@@ -791,7 +792,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 94cb5bbd6cbec53530b72cc4b2b8448f050a0525..b2982de8dc3697e8b2453401f2be31802b2f21bf 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -37,6 +37,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.
+
 - Issue #10987: Fix the recursion limit handling in the _pickle module.
 
 - Issue #10949: Improved robustness of rotating file handlers.