Issue #27972: Prohibit Tasks to await on themselves.

This commit is contained in:
Yury Selivanov 2016-10-09 12:19:12 -04:00
parent 908d55dd7e
commit 4145c83806
3 changed files with 27 additions and 7 deletions

View file

@ -92,6 +92,17 @@ class TaskTests(test_utils.TestCase):
finally:
other_loop.close()
def test_task_awaits_on_itself(self):
@asyncio.coroutine
def test():
yield from task
task = asyncio.ensure_future(test(), loop=self.loop)
with self.assertRaisesRegex(RuntimeError,
'Task cannot await on itself'):
self.loop.run_until_complete(task)
def test_task_class(self):
@asyncio.coroutine
def notmuch():