[3.5] bpo-30048: asyncio: fix Task.cancel() was ignored. by methane · Pull Request #1547 · python/cpython

@methane

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 991adca)

@methane methane changed the title bpo-30048: asyncio: fix Task.cancel() was ignored. [3.5] bpo-30048: asyncio: fix Task.cancel() was ignored.

May 11, 2017

@methane