-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Replace usage of strict_exception_groups=False in Nursery.start #2938
Replace usage of strict_exception_groups=False in Nursery.start #2938
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2938 +/- ##
=======================================
Coverage 99.64% 99.64%
=======================================
Files 116 116
Lines 17506 17523 +17
Branches 3148 3151 +3
=======================================
+ Hits 17444 17461 +17
Misses 43 43
Partials 19 19
|
# TODO: give a deprecationwarning instead? | ||
raise TrioInternalError( | ||
"internal nursery should not have multiple tasks" | ||
) from exc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked how one of the linked PRs proposed warning in .start_soon
for that internal nursery (re: todo)
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
sounds like we're settling on internalerror, and leaving any eventual warning for #1600 or similar. |
Very nice! Merging now 😁 |
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.