This commit is contained in:
Raymond Hettinger 2016-09-09 15:58:00 -07:00
commit f1024f7425
7 changed files with 96 additions and 19 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