[pypy-commit] pypy py3k: stdout/err should default to buffered
pjenvey
noreply at buildbot.pypy.org
Sun Apr 14 23:40:59 CEST 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r63347:5131e9ae9bec
Date: 2013-04-14 14:40 -0700
http://bitbucket.org/pypy/pypy/changeset/5131e9ae9bec/
Log: stdout/err should default to buffered
diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -264,7 +264,7 @@
# shouldn't make a difference in common use cases, second because
# TextIOWrapper depends on the presence of a read1() method which
# only exists on buffered streams.
- buffering = 0 if writing else -1
+ buffering = 0 if unbuffered and writing else -1
mode = 'w' if writing else 'r'
try:
buf = io.open(fd, mode + 'b', buffering, closefd=False)
diff --git a/pypy/interpreter/test2/test_app_main.py b/pypy/interpreter/test2/test_app_main.py
--- a/pypy/interpreter/test2/test_app_main.py
+++ b/pypy/interpreter/test2/test_app_main.py
@@ -460,6 +460,11 @@
finally:
os.environ['PYTHONPATH'] = old
+ def test_buffered(self):
+ line = 'import sys;print(type(sys.stdout.buffer).__name__)'
+ child = self.spawn(['-c', line])
+ child.expect('BufferedWriter')
+
def test_unbuffered(self):
# In Python3, -u affects the "binary layer" of sys.stdout.
line = 'import os,sys;sys.stdout.buffer.write(str(789).encode());os.read(0,1)'
More information about the pypy-commit
mailing list