coroutines: Error when awaiting on coroutine that's being awaited

Issue #25888
This commit is contained in:
Yury Selivanov 2016-03-02 11:30:46 -05:00
parent e076ffb068
commit c724bae51c
4 changed files with 40 additions and 6 deletions

View file

@ -942,6 +942,24 @@ class CoroutineTest(unittest.TestCase):
with self.assertRaises(Marker):
c.throw(ZeroDivisionError)
def test_await_15(self):
@types.coroutine
def nop():
yield
async def coroutine():
await nop()
async def waiter(coro):
await coro
coro = coroutine()
coro.send(None)
with self.assertRaisesRegex(RuntimeError,
"coroutine is being awaited already"):
waiter(coro).send(None)
def test_with_1(self):
class Manager:
def __init__(self, name):