Message193666
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. |
|
Date |
User |
Action |
Args |
2013-07-24 18:24:52 | nikratio | set | recipients:
+ nikratio, pitrou, benjamin.peterson, stutzbach, r.david.murray, hynek, serhiy.storchaka |
2013-07-24 18:24:52 | nikratio | link | issue18524 messages |
2013-07-24 18:24:52 | nikratio | create | |
|