]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1546) 1548/head
authorINADA Naoki <methane@users.noreply.github.com>
Thu, 11 May 2017 12:56:42 +0000 (21:56 +0900)
committerGitHub <noreply@github.com>
Thu, 11 May 2017 12:56:42 +0000 (21:56 +0900)
commit3dc7c52a9f4fb83be3e26e31e2c7cd9dc1cb41a2
tree8b20f9ecf036824ee1e6fbd08b890f4024d7531b
parenta4465a5bd08f232cf097893006118c82975c3402
bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1546)

when there are no more `await` or `yield (from)` before return in coroutine,
cancel was ignored.

example:

    async def coro():
        asyncio.Task.current_task().cancel()
        return 42
    ...
    res = await coro()  # should raise CancelledError

(cherry picked from commit 991adca012f5e106c2d4040ce619c696ba6f9c46)
Lib/asyncio/tasks.py
Lib/test/test_asyncio/test_tasks.py
Misc/NEWS
Modules/_asynciomodule.c