Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r51732:698aff2e6ca7
Date: 2012-01-24 16:36 +0100
http://bitbucket.org/pypy/pypy/changeset/698aff2e6ca7/

Log:    hardcode the sys.std{in,out,err} encoding to ascii when running the
        tests. Two reasons: 1. if you don't specificy the encoding, it ends
        up using locate.getpreferredlocale() to guess one. I don't think
        it's a good idea that the behavior of the tests depend on the locale
        settings

        2. importing locale is very slow on py.py. By using the explicit
        encoding, initializing the space takes ~3 seconds instead of ~10 on
        my machine

diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py
--- a/pypy/module/sys/__init__.py
+++ b/pypy/module/sys/__init__.py
@@ -116,11 +116,14 @@
             # Install standard streams for tests that don't call app_main
             space.appexec([], """():
                 import sys, io
-                sys.stdin = sys.__stdin__ = io.open(0, "r", closefd=False)
+                sys.stdin = sys.__stdin__ = io.open(0, "r", encoding="ascii",
+                                                    closefd=False)
                 sys.stdin.buffer.raw.name = "<stdin>"
-                sys.stdout = sys.__stdout__ = io.open(1, "w", closefd=False)
+                sys.stdout = sys.__stdout__ = io.open(1, "w", encoding="ascii",
+                                                      closefd=False)
                 sys.stdout.buffer.raw.name = "<stdout>"
-                sys.stderr = sys.__stderr__ = io.open(2, "w", closefd=False)
+                sys.stderr = sys.__stderr__ = io.open(2, "w", encoding="ascii",
+                                                      closefd=False)
                 sys.stderr.buffer.raw.name = "<stderr>"
                """)
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to