@@ -1498,7 +1498,7 @@ create_stdio(PyObject* io,
14981498 PyObject * buf = NULL , * stream = NULL , * text = NULL , * raw = NULL , * res ;
14991499 const char * mode ;
15001500 const char * newline ;
1501- PyObject * line_buffering ;
1501+ PyObject * line_buffering , * write_through ;
15021502 int buffering , isatty ;
15031503 _Py_IDENTIFIER (open );
15041504 _Py_IDENTIFIER (isatty );
@@ -1555,7 +1555,11 @@ create_stdio(PyObject* io,
15551555 Py_DECREF (res );
15561556 if (isatty == -1 )
15571557 goto error ;
1558- if (isatty || Py_UnbufferedStdioFlag )
1558+ if (Py_UnbufferedStdioFlag )
1559+ write_through = Py_True ;
1560+ else
1561+ write_through = Py_False ;
1562+ if (isatty && !Py_UnbufferedStdioFlag )
15591563 line_buffering = Py_True ;
15601564 else
15611565 line_buffering = Py_False ;
@@ -1574,9 +1578,9 @@ create_stdio(PyObject* io,
15741578 newline = "\n" ;
15751579#endif
15761580
1577- stream = _PyObject_CallMethodId (io , & PyId_TextIOWrapper , "OsssO " ,
1581+ stream = _PyObject_CallMethodId (io , & PyId_TextIOWrapper , "OsssOO " ,
15781582 buf , encoding , errors ,
1579- newline , line_buffering );
1583+ newline , line_buffering , write_through );
15801584 Py_CLEAR (buf );
15811585 if (stream == NULL )
15821586 goto error ;
0 commit comments