STINNER Victor <victor.stin...@gmail.com> added the comment:

> The falling back to read() was implemented in issue12591. What methods still 
> require read1()?

I read the Python implementation of TextIOWrapper in _pyio:

* seek() calls buffer.read() "if chars_to_skip:"... not sure that it can happen 
if buffer is a FileIO?
* read(None)  and read(-1) to read "everything" (until EOF): buffer.read()

It seems like read(None) also calls buffer.read() in the C implementation, 
_io_TextIOWrapper_read_impl():

        /* Read everything */
        PyObject *bytes = _PyObject_CallMethodId(self->buffer, &PyId_read, 
NULL);
        PyObject *decoded;
        if (bytes == NULL)
            goto fail;

and in _io_TextIOWrapper_seek_impl():

        /* Just like _read_chunk, feed the decoder and save a snapshot. */
        PyObject *input_chunk = _PyObject_CallMethodId(
            self->buffer, &PyId_read, "i", cookie.bytes_to_feed);

----------

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

Reply via email to