This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author althonos2
Recipients althonos2, docs@python
Date 2021-02-04.14:28:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612448887.77.0.51336599468.issue43126@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-02-04 14:28:07althonos2setrecipients: + althonos2, docs@python
2021-02-04 14:28:07althonos2setmessageid: <1612448887.77.0.51336599468.issue43126@roundup.psfhosted.org>
2021-02-04 14:28:07althonos2linkissue43126 messages
2021-02-04 14:28:07althonos2create