Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Doc/library/asyncio-stream.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,20 @@ StreamReader

.. coroutinemethod:: read(n=-1)

Read up to *n* bytes. If *n* is not provided, or set to ``-1``,
read until EOF and return all read bytes.
Read up to *n* bytes.
Comment thread
jgosmann marked this conversation as resolved.
Outdated

If *n* is not provided, or set to ``-1``,
Comment thread
jgosmann marked this conversation as resolved.
Outdated
read until EOF. After EOF is received, return all read bytes.
Comment thread
CAM-Gerlach marked this conversation as resolved.
Outdated
If EOF was received and the internal buffer is empty,
return an empty ``bytes`` object.

If *n* is zero, return empty ``bytes`` object immediately.
Comment thread
jgosmann marked this conversation as resolved.
Outdated

If *n* is positive, this function tries to read *n* bytes, and may return
less or equal bytes than requested, but at least one byte. If EOF was
received before any byte is read, this function returns an empty
``bytes`` object.
Comment thread
CAM-Gerlach marked this conversation as resolved.
Outdated

.. coroutinemethod:: readline()

Read one line, where "line" is a sequence of bytes
Expand Down
4 changes: 2 additions & 2 deletions Lib/asyncio/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,9 @@ async def read(self, n=-1):

If n is zero, return empty bytes object immediately.

If n is positive, this function try to read `n` bytes, and may return
If n is positive, this function tries to read `n` bytes, and may return
less or equal bytes than requested, but at least one byte. If EOF was
received before any byte is read, this function returns empty byte
received before any byte is read, this function returns an empty bytes
Comment thread
CAM-Gerlach marked this conversation as resolved.
Outdated
object.

Returned value is not limited with limit, configured at stream
Expand Down