python-trio / trio

Trio – a friendly Python library for async concurrency and I/O
https://trio.readthedocs.io
Other
5.98k stars 325 forks source link

Replace usage of strict_exception_groups=False in Nursery.start #2938

Closed jakkdl closed 5 months ago

jakkdl commented 5 months ago

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.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (7cb15ea) 99.64% compared to head (03fee26) 99.64%.

Additional details and impacted files ```diff @@ 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 ``` | [Files](https://app.codecov.io/gh/python-trio/trio/pull/2938?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-trio) | Coverage Δ | | |---|---|---| | [src/trio/\_core/\_run.py](https://app.codecov.io/gh/python-trio/trio/pull/2938?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-trio#diff-c3JjL3RyaW8vX2NvcmUvX3J1bi5weQ==) | `99.66% <100.00%> (+<0.01%)` | :arrow_up: | | [src/trio/\_core/\_tests/test\_run.py](https://app.codecov.io/gh/python-trio/trio/pull/2938?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-trio#diff-c3JjL3RyaW8vX2NvcmUvX3Rlc3RzL3Rlc3RfcnVuLnB5) | `100.00% <100.00%> (ø)` | |
jakkdl commented 5 months ago

sounds like we're settling on internalerror, and leaving any eventual warning for #1600 or similar. removed the comment and expanded the error message to make it clearer for the user that it might be their fault.

Zac-HD commented 5 months ago

Very nice! Merging now 😁