New submission from akira:

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

----------
components: IO
messages: 217600
nosy: akira
priority: normal
severity: normal
status: open
title: Python io implementation doesn't flush with write_through=True unlike C 
implementation
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21396>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to