[pypy-commit] pypy cffi-embedding-win32: force binary mode io for win32, with side effect of making io unbuffered

mattip pypy.commits at gmail.com
Mon Feb 1 17:25:36 EST 2016


Author: mattip <matti.picus at gmail.com>
Branch: cffi-embedding-win32
Changeset: r82038:e1b9c0216be7
Date: 2016-02-02 00:24 +0200
http://bitbucket.org/pypy/pypy/changeset/e1b9c0216be7/

Log:	force binary mode io for win32, with side effect of making io
	unbuffered

diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -105,6 +105,10 @@
         space.appexec([w_path], """(path):
             import sys
             sys.path[:] = path
+            import os
+            sys.stdin  = sys.__stdin__  = os.fdopen(0, 'rb', 0)
+            sys.stdout = sys.__stdout__ = os.fdopen(1, 'wb', 0)
+            sys.stderr = sys.__stderr__ = os.fdopen(2, 'wb', 0)
         """)
         # import site
         try:


More information about the pypy-commit mailing list