diff options
author | Yury Selivanov <yury@magic.io> | 2016-09-15 16:50:23 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-09-15 16:50:23 (GMT) |
commit | 8987c9d219f0efb438f5d707a63d0a0a0f72b3ef (patch) | |
tree | 409543083b30dda1c786a619ab9012b0c9e0483f /Lib/asyncio | |
parent | 67752315979e1501b7088273b5a1aecc90b6fe67 (diff) | |
download | cpython-8987c9d219f0efb438f5d707a63d0a0a0f72b3ef.zip cpython-8987c9d219f0efb438f5d707a63d0a0a0f72b3ef.tar.gz cpython-8987c9d219f0efb438f5d707a63d0a0a0f72b3ef.tar.bz2 |
Issue #26182: Raise DeprecationWarning for improper use of async/await keywords
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/tasks.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 35c945c..4c66546 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -519,7 +519,7 @@ def sleep(delay, result=None, *, loop=None): h.cancel() -def async(coro_or_future, *, loop=None): +def async_(coro_or_future, *, loop=None): """Wrap a coroutine in a future. If the argument is a Future, it is returned directly. @@ -532,6 +532,11 @@ def async(coro_or_future, *, loop=None): return ensure_future(coro_or_future, loop=loop) +# Silence DeprecationWarning: +globals()['async'] = async_ +async_.__name__ = 'async' +del async_ + def ensure_future(coro_or_future, *, loop=None): """Wrap a coroutine or an awaitable in a future. |