Skip to content

Commit 62588a1

Browse files
committed
extmod/uasyncio: Make leaf uasyncio functions non-async.
Otherwise they are async generators which is not the intention. Signed-off-by: Damien George <damien@micropython.org>
1 parent 6ec109c commit 62588a1

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

extmod/uasyncio/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def set(self):
2121
def clear(self):
2222
self.state = False
2323

24-
async def wait(self):
24+
def wait(self):
2525
if not self.state:
2626
# Event not set, put the calling task on the event's waiting queue
2727
self.waiting.push_head(core.cur_task)

extmod/uasyncio/lock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def release(self):
2828
# No Task waiting so unlock
2929
self.state = 0
3030

31-
async def acquire(self):
31+
def acquire(self):
3232
if self.state != 0:
3333
# Lock unavailable, put the calling Task on the waiting queue
3434
self.waiting.push_head(core.cur_task)

extmod/uasyncio/stream.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ async def wait_closed(self):
2626
# TODO yield?
2727
self.s.close()
2828

29-
async def read(self, n):
29+
def read(self, n):
3030
yield core._io_queue.queue_read(self.s)
3131
return self.s.read(n)
3232

33-
async def readexactly(self, n):
33+
def readexactly(self, n):
3434
r = b""
3535
while n:
3636
yield core._io_queue.queue_read(self.s)
@@ -42,7 +42,7 @@ async def readexactly(self, n):
4242
n -= len(r2)
4343
return r
4444

45-
async def readline(self):
45+
def readline(self):
4646
l = b""
4747
while True:
4848
yield core._io_queue.queue_read(self.s)
@@ -54,7 +54,7 @@ async def readline(self):
5454
def write(self, buf):
5555
self.out_buf += buf
5656

57-
async def drain(self):
57+
def drain(self):
5858
mv = memoryview(self.out_buf)
5959
off = 0
6060
while off < len(mv):
@@ -71,7 +71,7 @@ async def drain(self):
7171

7272

7373
# Create a TCP stream connection to a remote host
74-
async def open_connection(host, port):
74+
def open_connection(host, port):
7575
from uerrno import EINPROGRESS
7676
import usocket as socket
7777

@@ -103,7 +103,7 @@ def close(self):
103103
async def wait_closed(self):
104104
await self.task
105105

106-
async def _serve(self, cb, host, port, backlog):
106+
def _serve(self, cb, host, port, backlog):
107107
import usocket as socket
108108

109109
ai = socket.getaddrinfo(host, port)[0] # TODO this is blocking!

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy