Author akira
Recipients akira
Date 2014-04-30.10:36:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398854217.51.0.158914324658.issue21396@psf.upfronthosting.co.za>
In-reply-to
Content
related: msg217596 (bufsize=1 is broken if subprocess module uses Python io)

TextIOWrapper.write behavior:

_pyio.py [1]:

        if self._line_buffering and (haslf or "\r" in s):
            self.flush()

textio.c [2]:

    if (self->write_through)
        needflush = 1;
    else if (self->line_buffering &&
        (haslf ||
         PyUnicode_FindChar(text, '\r', 0, PyUnicode_GET_LENGTH(text), 1) != -1))
        needflush = 1;

C implementation calls flush() if write_through=True, Python implementation doesn't.

[1]: http://hg.python.org/cpython/file/0b2e199ad088/Lib/_pyio.py#l1636
[2]: http://hg.python.org/cpython/file/0b2e199ad088/Modules/_io/textio.c#l1333
History
Date User Action Args
2014-04-30 10:36:57akirasetrecipients: + akira
2014-04-30 10:36:57akirasetmessageid: <1398854217.51.0.158914324658.issue21396@psf.upfronthosting.co.za>
2014-04-30 10:36:57akiralinkissue21396 messages
2014-04-30 10:36:57akiracreate