extmod/uasyncio: Add StreamReader/StreamWriter as aliases of Stream cls.

To be compatible with CPython.  Fixes issue #5847.
pull/5849/merge
Damien George 2020-04-02 00:51:00 +11:00
rodzic aca19c25d2
commit f97b5395ed
3 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -177,7 +177,8 @@ TCP stream connections
.. class:: Stream()
This represents a TCP stream connection. To minimise code this class implements
both a reader and a writer.
both a reader and a writer, and both ``StreamReader`` and ``StreamWriter`` alias to
this class.
.. method:: Stream.get_extra_info(v)

Wyświetl plik

@ -12,6 +12,8 @@ _attrs = {
"Lock": "lock",
"open_connection": "stream",
"start_server": "stream",
"StreamReader": "stream",
"StreamWriter": "stream",
}
# Lazy loader, effectively does:

Wyświetl plik

@ -53,6 +53,11 @@ class Stream:
self.out_buf = b""
# Stream can be used for both reading and writing to save code size
StreamReader = Stream
StreamWriter = Stream
# Create a TCP stream connection to a remote host
async def open_connection(host, port):
from uerrno import EINPROGRESS