Message386484
The documentation for `IOBase.readlines` states that the `hint` optional argument should be used like so (https://docs.python.org/3/library/io.html#io.IOBase.readlines):
> Read and return a list of lines from the stream. hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.
So in the case where `hint` is null, I would expect `readlines` to return an empty list.
However, this is neither the case for `io.BytesIO` nor for `io.FileIO`:
```
import io
io.BytesIO(b"abc\ndef\nghi\n").readlines(0)
# this evaluates to [b"abc\n", b"def\n", b"ghi\n"]
```
If this is the intended behaviour, the documentation should be updated, otherwise the code from the `io` module should be fixed. |
|
Date |
User |
Action |
Args |
2021-02-04 14:28:07 | althonos2 | set | recipients:
+ althonos2, docs@python |
2021-02-04 14:28:07 | althonos2 | set | messageid: <1612448887.77.0.51336599468.issue43126@roundup.psfhosted.org> |
2021-02-04 14:28:07 | althonos2 | link | issue43126 messages |
2021-02-04 14:28:07 | althonos2 | create | |
|