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 loewis
Recipients alexandre.vassalotti, gregory.p.smith, loewis, pitrou
Date 2008-07-21.21:18:50
SpamBayes Score 0.118971
Marked as misclassified No
Message-id <4884FD38.4020206@v.loewis.de>
In-reply-to <1216632612.48845724ee88b@imp.free.fr>
Content
>>   max(buffer_size, n-avail)
> 
> I mimicked the original logic rather than rethink the algorithm. I'm not totally
> sure what motivates the original logic but the purpose seems to be that
> non-blocking streams can return at least a few bytes rather than an empty string
> when less than N bytes are ready at OS level.

IIUC, a read of the full requested size would achieve exactly that: on a
non-blocking stream (IIUC), a read will always return
min(bytes_available, bytes_requested).

> Hmm, what do you mean by "if the stream is unbuffered"? Unbuffered streams
> should use the raw unbuffered objects (e.g. FileIO) rather than wrap them with
> BufferedReader.

IIUC, io.open will always return a BufferedReader, potentially with
buffer_size=0 for unbuffered IO. This case must be supported.
History
Date User Action Args
2008-07-21 21:18:52loewissetspambayes_score: 0.118971 -> 0.118971
recipients: + loewis, gregory.p.smith, pitrou, alexandre.vassalotti
2008-07-21 21:18:51loewislinkissue2523 messages
2008-07-21 21:18:50loewiscreate