aboutsummaryrefslogtreecommitdiff
path: root/extmod/uasyncio
diff options
context:
space:
mode:
authorDamien George2020-04-02 00:51:00 +1100
committerDamien George2020-04-02 00:51:00 +1100
commitf97b5395ed4b03d8cce6fda0c4b41d8118843690 (patch)
tree3703e9b385ab28eab0d33dca41eb32a688fc4754 /extmod/uasyncio
parentaca19c25d250b8abb91211e2392e01b5611325c9 (diff)
extmod/uasyncio: Add StreamReader/StreamWriter as aliases of Stream cls.
To be compatible with CPython. Fixes issue #5847.
Diffstat (limited to 'extmod/uasyncio')
-rw-r--r--extmod/uasyncio/__init__.py2
-rw-r--r--extmod/uasyncio/stream.py5
2 files changed, 7 insertions, 0 deletions
diff --git a/extmod/uasyncio/__init__.py b/extmod/uasyncio/__init__.py
index 6bff13883..da8b58061 100644
--- a/extmod/uasyncio/__init__.py
+++ b/extmod/uasyncio/__init__.py
@@ -12,6 +12,8 @@ _attrs = {
"Lock": "lock",
"open_connection": "stream",
"start_server": "stream",
+ "StreamReader": "stream",
+ "StreamWriter": "stream",
}
# Lazy loader, effectively does:
diff --git a/extmod/uasyncio/stream.py b/extmod/uasyncio/stream.py
index 7803ac4bf..2a1efd1a1 100644
--- a/extmod/uasyncio/stream.py
+++ b/extmod/uasyncio/stream.py
@@ -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