[pypy-svn] pypy fast-forward: On linux, the _locale module to get the default encoding

amauryfa commits-noreply at bitbucket.org
Fri Jan 14 00:34:03 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40650:3582f61188ac
Date: 2011-01-14 00:33 +0100
http://bitbucket.org/pypy/pypy/changeset/3582f61188ac/

Log:	On linux, the _locale module to get the default encoding

diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -296,6 +296,9 @@
                 if not e.match(space, space.w_ImportError):
                     raise
                 self.w_encoding = space.wrap("ascii")
+            else:
+                if not space.isinstance_w(self.w_encoding, space.w_str):
+                    self.w_encoding = None
         if self.w_encoding:
             pass
         elif not space.is_w(w_encoding, space.w_None):

diff --git a/pypy/module/_io/test/test_textio.py b/pypy/module/_io/test/test_textio.py
--- a/pypy/module/_io/test/test_textio.py
+++ b/pypy/module/_io/test/test_textio.py
@@ -2,7 +2,7 @@
 
 class AppTestTextIO:
     def setup_class(cls):
-        cls.space = gettestobjspace(usemodules=['_io'])
+        cls.space = gettestobjspace(usemodules=['_io', '_locale'])
 
     def test_constructor(self):
         import _io


More information about the Pypy-commit mailing list