Commit b3dd6d70 authored by Yury Selivanov's avatar Yury Selivanov

asyncio: Error if awaiting in parallel on the same coroutine

This change won't do anything in CPython 3.4

See https://github.com/python/asyncio/pull/293 for details.
parent 38fe4dc4
......@@ -140,7 +140,13 @@ class CoroWrapper:
if compat.PY35:
__await__ = __iter__ # make compatible with 'await' expression
def __await__(self):
cr_await = getattr(self.gen, 'cr_await', None)
if cr_await is not None:
raise RuntimeError(
"Cannot await on coroutine {!r} while it's "
"awaiting for {!r}".format(self.gen, cr_await))
return self
@property
def gi_yieldfrom(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment