extmod/uasyncio: Implement stream read(-1) to read all data up to EOF.

Fixes issue #6355.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2020-08-22 16:39:15 +10:00
parent 2a2589738c
commit db7682e02d
4 changed files with 83 additions and 5 deletions

View File

@@ -237,9 +237,11 @@ TCP stream connections
This is a coroutine.
.. method:: Stream.read(n)
.. method:: Stream.read(n=-1)
Read up to *n* bytes and return them.
Read up to *n* bytes and return them. If *n* is not provided or -1 then read all
bytes until EOF. The returned value will be an empty bytes object if EOF is
encountered before any bytes are read.
This is a coroutine.