summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-09 16:19:12 (GMT)
committerYury Selivanov <yury@magic.io>2016-10-09 16:19:12 (GMT)
commit4145c8380699f7af14ae15179e01652e25f0d102 (patch)
treed978e85119ce1efc2cb4643bf7ab9779102d3256 /Lib/test
parent908d55dd7e395779ed1eb5c96664aca6297fedaa (diff)
downloadcpython-4145c8380699f7af14ae15179e01652e25f0d102.zip
cpython-4145c8380699f7af14ae15179e01652e25f0d102.tar.gz
cpython-4145c8380699f7af14ae15179e01652e25f0d102.tar.bz2
Issue #27972: Prohibit Tasks to await on themselves.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 2863c42..a5af7d1 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -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():