Commits

Antonio Cuni committed 698aff2

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

Comments (0)

Files changed (1)

pypy/module/sys/__init__.py

             # 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>"
                """)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.