[3.11] GH-95704: Don't suppress errors from tasks when TG is cancelled (GH-95761)#96048
Merged
miss-islington merged 1 commit intopython:3.11from Aug 17, 2022
Merged
Conversation
…pythonGH-95761) When a task catches CancelledError and raises some other error, the other error should not silently be suppressed. Any scenario where a task crashes in cleanup upon cancellation will now result in an ExceptionGroup wrapping the crash(es) instead of propagating CancelledError and ignoring the side errors. NOTE: This represents a change in behavior (hence the need to change several tests). But it is only an edge case. Co-authored-by: Thomas Grainger <tagrain@gmail.com> (cherry picked from commit f51f54f) Co-authored-by: Guido van Rossum <guido@python.org>
Member
|
@pablogsal -- this is a small change to TaskGroup itself, but it does change a bunch of TaskGroup tests that were previously expecting side errors to be ignored. |
gvanrossum
approved these changes
Aug 17, 2022
Contributor
Author
|
Status check is done, and it's a success ✅ . |
Member
|
Whoa, Miss-Islington auto-merged it. I did not expect that. Sorry. |
Member
Don't worry about it. I reviewed it and looks good 👍 |
Member
|
Thanks for the explanation in the meeting! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a task catches CancelledError and raises some other error,
the other error should not silently be suppressed.
Any scenario where a task crashes in cleanup upon cancellation
will now result in an ExceptionGroup wrapping the crash(es)
instead of propagating CancelledError and ignoring the side errors.
NOTE: This represents a change in behavior (hence the need to
change several tests). But it is only an edge case.
Co-authored-by: Thomas Grainger tagrain@gmail.com
(cherry picked from commit f51f54f)
Co-authored-by: Guido van Rossum guido@python.org