Merge asyncio upstream.

This commit is contained in:
Guido van Rossum 2016-09-09 14:26:31 -07:00
parent 9b32bda851
commit 7b3b3dc85d
6 changed files with 94 additions and 14 deletions

View file

@ -204,8 +204,8 @@ def coroutine(func):
@functools.wraps(func)
def coro(*args, **kw):
res = func(*args, **kw)
if isinstance(res, futures.Future) or inspect.isgenerator(res) or \
isinstance(res, CoroWrapper):
if (futures.isfuture(res) or inspect.isgenerator(res) or
isinstance(res, CoroWrapper)):
res = yield from res
elif _AwaitableABC is not None:
# If 'func' returns an Awaitable (new in 3.5) we