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

@methane

@methane

example:

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

1st1

1st1 approved these changes May 9, 2017

@methane

@methane

@methane methane deleted the asyncio-task-cancel branch

May 11, 2017 12:18

methane added a commit to methane/cpython that referenced this pull request

May 11, 2017
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 added a commit to methane/cpython that referenced this pull request

May 11, 2017
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 added a commit that referenced this pull request

May 12, 2017
* 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
(cherry picked from commit 991adca)

* fix test