Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r63720:e06da28508f3
Date: 2013-04-27 12:10 +0200
http://bitbucket.org/pypy/pypy/changeset/e06da28508f3/

Log:    Applevel tests now create sys.stdout in line-buffered mode. This
        should fix some threaded tests, which rely on a print() call to
        trigger a thread switch.

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
@@ -112,17 +112,21 @@
                 space.setitem(self.w_dict, space.wrap("dllhandle"), w_handle)
 
         if not space.config.translating:
-            # Install standard streams for tests that don't call app_main
+            # Install standard streams for tests that don't call app_main.
+            # Always use line buffering, even for tests that capture
+            # standard descriptors.
             space.appexec([], """():
                 import sys, io
                 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", encoding="ascii",
+                                                      buffering=1,
                                                       closefd=False)
                 sys.stdout.buffer.raw.name = "<stdout>"
                 sys.stderr = sys.__stderr__ = io.open(2, "w", encoding="ascii",
                                                       
errors="backslashreplace",
+                                                      buffering=1,
                                                       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