mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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.
This commit is contained in:
parent
38fe4dc400
commit
b3dd6d70c7
1 changed files with 7 additions and 1 deletions
|
@ -140,7 +140,13 @@ class CoroWrapper:
|
||||||
|
|
||||||
if compat.PY35:
|
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
|
@property
|
||||||
def gi_yieldfrom(self):
|
def gi_yieldfrom(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue