This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2017-10-12.15:46:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507823181.83.0.213398074469.issue31775@psf.upfronthosting.co.za>
In-reply-to
Content
> 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);
History
Date User Action Args
2017-10-12 15:46:21vstinnersetrecipients: + vstinner, serhiy.storchaka
2017-10-12 15:46:21vstinnersetmessageid: <1507823181.83.0.213398074469.issue31775@psf.upfronthosting.co.za>
2017-10-12 15:46:21vstinnerlinkissue31775 messages
2017-10-12 15:46:21vstinnercreate