]> granicus.if.org Git - python/commit
bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1097)
authorINADA Naoki <methane@users.noreply.github.com>
Thu, 11 May 2017 12:18:38 +0000 (21:18 +0900)
committerGitHub <noreply@github.com>
Thu, 11 May 2017 12:18:38 +0000 (21:18 +0900)
commit991adca012f5e106c2d4040ce619c696ba6f9c46
tree90fa267454273f2e779ceffbeeae2ff84d5f01ca
parentc4750959acbfc3057f12aaec832483ba30898d1c
bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1097)

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
Lib/asyncio/tasks.py
Lib/test/test_asyncio/test_tasks.py
Misc/NEWS
Modules/_asynciomodule.c