[pypy-commit] pypy py3.3: handle a base_encoding of 'utf-8' on osx

pjenvey noreply at buildbot.pypy.org
Mon Dec 29 22:14:07 CET 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3.3
Changeset: r75151:24d64c593bda
Date: 2014-12-29 13:12 -0800
http://bitbucket.org/pypy/pypy/changeset/24d64c593bda/

Log:	handle a base_encoding of 'utf-8' on osx

diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -168,7 +168,10 @@
         w_import = space.getattr(space.builtin, space.wrap("__import__"))
         space.call_function(w_import, space.wrap("encodings"))
         from pypy.module.sys.interp_encoding import base_encoding
-        space.call_function(w_import, space.wrap("encodings." + base_encoding))
+        # May be 'utf-8'
+        normalized_base = base_encoding.replace("-", "_").lower()
+        space.call_function(w_import, space.wrap("encodings." +
+                                                 normalized_base))
         state.codec_need_encodings = False
         if len(state.codec_search_path) == 0:
             raise OperationError(


More information about the pypy-commit mailing list