Skip to content

Commit 97d585d

Browse files
authored
Merge pull request CloudBotIRC#193 from linuxdaemon/gonzobot+async-wrapper
Fix SyntaxError on 3.7.0a2+ with use of async as a name
2 parents ce96fe2 + 69d0548 commit 97d585d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cloudbot/util/async_util.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ def wrap_future(fut, *, loop=None):
1616
:return: The wrapped future
1717
"""
1818
if sys.version_info < (3, 4, 4):
19-
return asyncio.async(fut, loop=loop)
19+
# This is to avoid a SyntaxError on 3.7.0a2+
20+
func = getattr(asyncio, "async")
21+
else:
22+
func = asyncio.ensure_future
2023

21-
return asyncio.ensure_future(fut, loop=loop)
24+
return func(fut, loop=loop)
2225

2326

2427
@asyncio.coroutine

0 commit comments

Comments
 (0)