mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
coroutines: Error when awaiting on coroutine that's being awaited
Issue #25888
This commit is contained in:
parent
e076ffb068
commit
c724bae51c
4 changed files with 40 additions and 6 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue