Skip to content

Commit cad7729

Browse files
committed
asyncio_slow: Rename "async()" to "ensure_future()".
"async()" was deprecated in CPython due to introduction of the similar keyword, and causes SyntaxError in MicroPython.
1 parent 9a5f94b commit cad7729

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

asyncio_slow/asyncio_slow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _cb():
4747
self.call_soon(_cb)
4848

4949
def run_until_complete(self, coro):
50-
t = async(coro)
50+
t = ensure_future(coro)
5151
t.add_done_callback(lambda a: self.stop())
5252
self.run_forever()
5353

@@ -109,7 +109,7 @@ def coroutine(f):
109109
return f
110110

111111

112-
def async(coro):
112+
def ensure_future(coro):
113113
if isinstance(coro, Future):
114114
return coro
115115
return Task(coro)
@@ -136,7 +136,7 @@ def wait(coro_list, loop=_def_event_loop):
136136
w = _Wait(len(coro_list))
137137

138138
for c in coro_list:
139-
t = async(c)
139+
t = ensure_future(c)
140140
t.add_done_callback(lambda val: w._done())
141141

142142
return w

0 commit comments

Comments
 (0)