Issue #26182: Raise DeprecationWarning for improper use of async/await keywords

This commit is contained in:
Yury Selivanov 2016-09-15 12:50:23 -04:00
parent 6775231597
commit 8987c9d219
6 changed files with 125 additions and 56 deletions

View file

@ -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.