Skip to content

[3.11] GH-95704: Don't suppress errors from tasks when TG is cancelled (GH-95761) #96048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2022

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Aug 17, 2022

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 [email protected]
(cherry picked from commit f51f54f)

Co-authored-by: Guido van Rossum [email protected]

…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 <[email protected]>
(cherry picked from commit f51f54f)

Co-authored-by: Guido van Rossum <[email protected]>
@gvanrossum
Copy link
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 gvanrossum removed request for 1st1 and asvetlov August 17, 2022 16:53
@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 36c114a into python:3.11 Aug 17, 2022
@miss-islington miss-islington deleted the backport-f51f54f-3.11 branch August 17, 2022 17:05
@gvanrossum
Copy link
Member

Whoa, Miss-Islington auto-merged it. I did not expect that. Sorry.

@pablogsal
Copy link
Member

Whoa, Miss-Islington auto-merged it. I did not expect that. Sorry.

Don't worry about it. I reviewed it and looks good 👍

@pablogsal
Copy link
Member

Thanks for the explanation in the meeting!

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