[pypy-commit] pypy py3k: normalize filesystemencoding

pjenvey noreply at buildbot.pypy.org
Sun Feb 17 21:31:29 CET 2013


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r61356:53e06c688aa3
Date: 2013-02-17 12:27 -0800
http://bitbucket.org/pypy/pypy/changeset/53e06c688aa3/

Log:	normalize filesystemencoding

diff --git a/pypy/module/sys/interp_encoding.py b/pypy/module/sys/interp_encoding.py
--- a/pypy/module/sys/interp_encoding.py
+++ b/pypy/module/sys/interp_encoding.py
@@ -44,7 +44,8 @@
                     w_res = space.call_method(codecmod, 'lookup',
                                               space.wrap(loc_codeset))
                     if space.is_true(w_res):
-                        encoding = loc_codeset
+                        w_name = space.getattr(w_res, space.wrap('name'))
+                        encoding = space.str_w(w_name)
             finally:
                 rlocale.setlocale(rlocale.LC_CTYPE, oldlocale)
         except rlocale.LocaleError:
diff --git a/pypy/module/sys/test/test_encoding.py b/pypy/module/sys/test/test_encoding.py
--- a/pypy/module/sys/test/test_encoding.py
+++ b/pypy/module/sys/test/test_encoding.py
@@ -23,8 +23,8 @@
             clear()
             os.environ.update(original_env)
 
-    assert get() in (base_encoding, 'ANSI_X3.4-1968')
-    assert get(LANG='foobar') in (base_encoding, 'ANSI_X3.4-1968')
-    assert get(LANG='en_US.UTF-8') == 'UTF-8'
-    assert get(LC_ALL='en_US.UTF-8') == 'UTF-8'
-    assert get(LC_CTYPE='en_US.UTF-8') == 'UTF-8'
+    assert get() in (base_encoding, 'ascii')
+    assert get(LANG='foobar') in (base_encoding, 'ascii')
+    assert get(LANG='en_US.UTF-8') == 'utf-8'
+    assert get(LC_ALL='en_US.UTF-8') == 'utf-8'
+    assert get(LC_CTYPE='en_US.UTF-8') == 'utf-8'


More information about the pypy-commit mailing list