[Python-checkins] cpython (3.3): Issue #20033: makelocalealias.py now works with non-ASCII locales and produces

serhiy.storchaka python-checkins at python.org
Tue Dec 24 08:03:18 CET 2013


http://hg.python.org/cpython/rev/22c59ddba494
changeset:   88156:22c59ddba494
branch:      3.3
parent:      88151:86e54df4312a
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Dec 23 18:56:08 2013 +0200
summary:
  Issue #20033: makelocalealias.py now works with non-ASCII locales and produces
the same result as in 2.x.

files:
  Tools/i18n/makelocalealias.py |  10 +++++-----
  1 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Tools/i18n/makelocalealias.py b/Tools/i18n/makelocalealias.py
--- a/Tools/i18n/makelocalealias.py
+++ b/Tools/i18n/makelocalealias.py
@@ -13,8 +13,8 @@
 
 def parse(filename):
 
-    f = open(filename)
-    lines = f.read().splitlines()
+    with open(filename, encoding='latin1') as f:
+        lines = list(f)
     data = {}
     for line in lines:
         line = line.strip()
@@ -47,15 +47,15 @@
 def pprint(data):
     items = sorted(data.items())
     for k, v in items:
-        print('    %-40s%r,' % ('%r:' % k, v))
+        print('    %-40s%a,' % ('%a:' % k, v))
 
 def print_differences(data, olddata):
     items = sorted(olddata.items())
     for k, v in items:
         if k not in data:
-            print('#    removed %r' % k)
+            print('#    removed %a' % k)
         elif olddata[k] != data[k]:
-            print('#    updated %r -> %r to %r' % \
+            print('#    updated %a -> %a to %a' % \
                   (k, olddata[k], data[k]))
         # Additions are not mentioned
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list