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 nikratio
Recipients nikratio
Date 2013-07-22.04:56:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374468975.95.0.466613665533.issue18524@psf.upfronthosting.co.za>
In-reply-to
Content
The read1() docstring says: "Reads up to n bytes, with at most one read() system call."

However, in the implementation read1() calls peek() to refill the buffer if necessary, and then returns whatever is available in the buffer.

This means that read1() will only return up to n bytes if n is smaller than the buffer size, otherwise it will return at most <buffer-size> bytes.


With the current implementation, running a loop that calls obj.read1(n) for large n is therefore much less performant than a loop that calls obj.raw.read(n). 

I think a call to read1(n) with empty buffer should always attempt to read n bytes from the raw stream, i.e. the implementation should be changed to match the documentation.
History
Date User Action Args
2013-07-22 04:56:16nikratiosetrecipients: + nikratio
2013-07-22 04:56:15nikratiosetmessageid: <1374468975.95.0.466613665533.issue18524@psf.upfronthosting.co.za>
2013-07-22 04:56:15nikratiolinkissue18524 messages
2013-07-22 04:56:15nikratiocreate