cpython: 8d877876aa89 (original) (raw)

Mercurial > cpython

changeset 104417:8d877876aa89 3.5

Issue #27972: Prohibit Tasks to await on themselves. [#27972]

Yury Selivanov yury@magic.io
date Sun, 09 Oct 2016 12:19:12 -0400
parents a3b162d5e70a
children 41c4f535b5c0 69fe5f2e5aae
files Lib/asyncio/tasks.py Lib/test/test_asyncio/test_tasks.py Misc/NEWS
diffstat 3 files changed, 27 insertions(+), 7 deletions(-)[+] [-] Lib/asyncio/tasks.py 21 Lib/test/test_asyncio/test_tasks.py 11 Misc/NEWS 2

line wrap: on

line diff

--- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -241,7 +241,7 @@ class Task(futures.Future): result = coro.throw(exc) except StopIteration as exc: self.set_result(exc.value)

@@ -259,12 +259,19 @@ class Task(futures.Future): 'Task {!r} got Future {!r} attached to a ' 'different loop'.format(self, result))) elif blocking:

--- 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_class(self): @asyncio.coroutine def notmuch():

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -388,6 +388,8 @@ Library