Skip to content

Conversation

@methane
Copy link
Member

@methane methane commented Apr 13, 2017

example:

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

@mention-bot
Copy link

@methane, thanks for your PR! By analyzing the history of the files in this pull request, we identified @1st1, @benjaminp and @bitdancer to be potential reviewers.

@methane methane force-pushed the asyncio-task-cancel branch 2 times, most recently from e2a323f to 4c881d3 Compare April 13, 2017 07:27
example:

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

@1st1 1st1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@methane methane merged commit 991adca into python:master May 11, 2017
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants