Martin v. Löwis <[EMAIL PROTECTED]> added the comment: >> 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. _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2523> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com