diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:30:46 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:30:46 (GMT) |
commit | c724bae51cd0580cd493f319f3b14c2e1a28f3b6 (patch) | |
tree | afe43c1777b5b40b5d352ed0cd232ec1c88b971c /Lib | |
parent | e076ffb068ce4e76a7103451c3bef79c2610f791 (diff) | |
download | cpython-c724bae51cd0580cd493f319f3b14c2e1a28f3b6.zip cpython-c724bae51cd0580cd493f319f3b14c2e1a28f3b6.tar.gz cpython-c724bae51cd0580cd493f319f3b14c2e1a28f3b6.tar.bz2 |
coroutines: Error when awaiting on coroutine that's being awaited
Issue #25888
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_coroutines.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index 954a9a1..187348d 100644 --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -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): |