summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-01-26 22:03:09 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-01-26 22:03:09 (GMT)
commit54243791fc6d24085fedc0369aa1b04efec85d55 (patch)
treed3aef5b7afbb7ccc76f85ffdd8ba25b4149a9d46 /Python/pythonrun.c
parent7d7573e4d48dfb2af8135919a0d4857cf0a759e8 (diff)
downloadcpython-54243791fc6d24085fedc0369aa1b04efec85d55.zip
cpython-54243791fc6d24085fedc0369aa1b04efec85d55.tar.gz
cpython-54243791fc6d24085fedc0369aa1b04efec85d55.tar.bz2
Merged revisions 68977,68981 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r68977 | antoine.pitrou | 2009-01-26 22:48:00 +0100 (lun., 26 janv. 2009) | 3 lines Followup of #4705: we can't skip the binary buffering layer for stdin because FileIO doesn't have a read1() method ........ r68981 | antoine.pitrou | 2009-01-26 23:00:21 +0100 (lun., 26 janv. 2009) | 3 lines Fix test so as to also pass in debug mode ........
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 6819be5..65c6f5f 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -739,7 +739,12 @@ create_stdio(PyObject* io,
PyObject *line_buffering;
int buffering, isatty;
- if (Py_UnbufferedStdioFlag)
+ /* stdin is always opened in buffered mode, first because it 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.
+ */
+ if (Py_UnbufferedStdioFlag && write_mode)
buffering = 0;
else
buffering = -1;
@@ -753,7 +758,7 @@ create_stdio(PyObject* io,
if (buf == NULL)
goto error;
- if (!Py_UnbufferedStdioFlag) {
+ if (buffering) {
raw = PyObject_GetAttrString(buf, "raw");
if (raw == NULL)
goto error;