Nikolaus Rath added the comment: On 07/24/2013 07:35 AM, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > >> 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. > > Did you actually observe such behaviour? If so, this is a bug.
Yes, that's what I see: $ python3 bug.py Read 20 bytes using read() Read 10 bytes using read1() $ cat bug.py #!/usr/bin/env python3 import io raw = io.BytesIO(bytes(200)) buffered = io.BufferedReader(raw, 10) data = buffered.read(20) print('Read %d bytes using read()' % len(data)) data = buffered.read1(20) print('Read %d bytes using read1()' % len(data)) There should be no problem reading 20 bytes with a single call to BytesIO.read(), yet the buffered reader returns only 10 bytes. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18524> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com