Message70119
| Author |
loewis |
| Recipients |
alexandre.vassalotti, gregory.p.smith, loewis, pitrou |
| Date |
2008年07月21日.21:18:50 |
| SpamBayes Score |
0.11897084 |
| 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. |
|