GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||
GeezerVison is showing github.com — gh-108951: document addition of TaskGroup.cancel() by belm0 · Pull Request #149031 · python/cpython Conversation
| |||||||||||
| @@ -1 +1 @@ | |||
| Add :meth:`~asyncio.TaskGroup.cancel` which cancels unfinished tasks and exits the group without error. | |||
| Add :meth:`~asyncio.TaskGroup.cancel` which cancels unfinished tasks and exits the group without raising :exc:`asyncio.CancelledError`. | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm still not sure if the explicit "and exits the group without raising :exc:asyncio.CancelledError" makes sense. All this does is 1) cancel all current tasks in the group and 2) set the task group into aborted mode which causes creation of further tasks to fail. With that in mind, I'm not sure why you chose to explicitly mention exiting the task group.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Further, this still begs to question why you said "without raising :exc:asyncio.CancelledError". This implies that otherwise it would raise a CancelledError, yes?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
well, if you check the long discussions in the impl PR, there was quite a bit made about possible confusion from expecting TaskGroup.cancel() to behave like Task.cancel(). So this is being explicit that unlike the latter, TaskGroup.cancel() does not cause anything to raise CancelledError.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think this could be reworded:
Add :meth:~asyncio.TaskGroup.cancel which cancels unfinished tasks in the group and prevents new ones from being created. If this requires cancellation of the host task, the task group will swallow the :exc:asyncio.CancelledError, unless the task was also cancelled from elsewhere.
Thoughts?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Alex Grönholm <[email protected]>
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LG, just one suggestion.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I've updated the rST markup because otherwise it will only show "cancel()" as a link and the user won't know whether it's asyncio.cancel or asyncio.something.cancel(). Apart from the rewording of the NEWS entry that I have no strong opinion about, I think we can merge this. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.