Replace usage of strict_exception_groups=False in Nursery.start#2938
Merged
Zac-HD merged 3 commits intopython-trio:masterfrom Jan 31, 2024
Merged
Replace usage of strict_exception_groups=False in Nursery.start#2938Zac-HD merged 3 commits intopython-trio:masterfrom
Zac-HD merged 3 commits intopython-trio:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2938 +/- ##
===================================================
+ Coverage 99.64717% 99.64751% +0.00033%
===================================================
Files 116 116
Lines 17572 17589 +17
Branches 3160 3163 +3
===================================================
+ Hits 17510 17527 +17
Misses 43 43
Partials 19 19
🚀 New features to boost your workflow:
|
A5rocks
reviewed
Jan 29, 2024
| # TODO: give a deprecationwarning instead? | ||
| raise TrioInternalError( | ||
| "internal nursery should not have multiple tasks" | ||
| ) from exc |
Contributor
There was a problem hiding this comment.
I liked how one of the linked PRs proposed warning in .start_soon for that internal nursery (re: todo)
Zac-HD
approved these changes
Jan 30, 2024
src/trio/_core/_run.py
Outdated
| except BaseExceptionGroup as exc: | ||
| if len(exc.exceptions) == 1: | ||
| raise exc.exceptions[0] from None | ||
| # TODO: give a deprecationwarning instead? |
Member
There was a problem hiding this comment.
I think making this an internal error immediately is fine - it's possible to do this, but it's never been something we documented or that we think is reasonable to have done for some reason.
Member
Author
|
sounds like we're settling on internalerror, and leaving any eventual warning for #1600 or similar. |
Member
|
Very nice! Merging now 😁 |
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.
In preparation for eventual deprecation of
strict_exception_groups=False(https://github.com/jakkdl/trio/tree/deprecate_exceptiongroups_false) we probably shouldn't rely on it ourselves in the internal code.#2611 - the original issue where errors raised before
task_status.started()got double-wrapped#1599 - for why the old nursery can have multiple tasks.
#2844 - the regression error that occured after my initial fix for #2611 in #2826
Fairly straightforward implementation, other than perhaps exactly what to raise when multiple exceptions do occur. The main code that tests this is
test_trio_run_strict_before_started, I added the new test after it only to trigger the case where multiple exceptions do pop up in the old nursery.