-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
remove multierror #2891
remove multierror #2891
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2891 +/- ##
==========================================
+ Coverage 99.49% 99.65% +0.16%
==========================================
Files 115 115
Lines 17704 17310 -394
Branches 3158 3110 -48
==========================================
- Hits 17615 17251 -364
+ Misses 70 40 -30
Partials 19 19
|
…nner check not being run
I experimented with removing the code that's supposedly there to fix |
do we want a newsfragment for now relying on exceptiongroup's apport excepthook monkeypatching? |
…taining backwards-compatibility from raising multierror's
Ya these cyclic gc tests have somewhat overlapping behavior, since we made them by tracking down cycles basically one-by-one in various scenarios. I'd say it's not trio's job to check if exception groups create garbage (anymore). The question is whether a similar test exists in the suite for exception groups in cpython or the backport. |
oh and yes please on this |
I totally agree with using python's built in ExceptionGroups, but what about python versions pre-3.11? My worry is for one of my own projects, I support 3.9 and up, but ExceptionGroup doesn't exist pre-3.11. My particular use case of MultiError: If I were using 3.11 + I would just use |
Oh I see, we can just use external |
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.
Looks good other than a few small things I noticed.
src/trio/_core/_run.py
Outdated
if not self._strict_exception_groups and len(self._pending_excs) == 1: | ||
return self._pending_excs[0] | ||
return BaseExceptionGroup( | ||
"collapsible" if not self._strict_exception_groups else "TODO", |
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.
What needs to be done in TODO here?
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.
The exception requires specifying a message, so we probably want some informative message on the cause of the exception or something.
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.
Made it a somewhat generic "Exceptions from Trio nursery". Am very open to suggestions for what else could be added.
Fixed as of CoolCat467/Scanner-Server@9ad2774 |
trio also has an exceptiongroup dependency on <3.11 |
I'm not finding anything with a quick search in the backport @agronholm I'm not familiar with the inner workings of gc and the implementation of multierror/exceptiongroup, but wouldn't the need for such tests depend on the manner of implementation? If the garbage was caused by hacky stuff that multierror needed to do in order to work, and cpython manages to sidestep that completely by implementing stuff """properly""", then there's no direct need for the tests on their side and/or they might have to look quite different. |
I'd add such tests to the backport only as regression tests if such a problem is detected there. |
oh actually, I am getting cyclic garbage test fails in some cases. Will push a commit with updated comments. |
Strangely enough I'm not managing to make this test fail now |
Just to be completely clear, every spooky |
…update comments, add test_nursery_loose_exception_groups, add string for the exceptiongroup
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 all the cyclic garbage changes are making sense. Hanging on to test_simple_cancel_scope_usage_doesnt_create_cyclic_garbage
even though it maybe can't fail currently is fine IMO since we want to cover outcome
and protect future refactoring.
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.
Two trivial nitpicks, but overall I think this is ready to merge.
I'd also be keen to ship a new version with this change ASAP, so that we can see it working in the wild before shipping #2886. That should reduce the risk of complications for everyone...
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.
Sorry about the wait; essentially just nitpicks (even about code you just copied over from elsewhere instead of writing :-) and I paid less attention to the tests.
), | ||
"NonBaseMultiError": _deprecate.DeprecatedAttribute( | ||
value=_NonBaseMultiError, | ||
version="0.22.0", |
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.
So I guess any release with these should be 0.24.0? Release preparation page says "two months or two releases, whichever is longer") and I assume it means minor releases.
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.
makes sense to do major (or whatever 0.X releases are called) release on both this and on #2886 since they can break stuff.
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 still don't get why Trio doesn't have a 1.0.0 release yet if compatibility guarantees are this stringent anyway.
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'd be inclined to go 1.0 when we've got this and strict-by-default in; I agree but it seems odd to make that release right before some substantial changes.
# Unclear if this can still fail, removing the `del` from _concat_tb.copy_tb does not seem | ||
# to trigger it (on a platform where the `del` is executed) |
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.
Huh, it might be a good idea to remove this test then and add a TODO
to that del
that it isn't tested for.
It seems like a good idea to try to remove unnecessary del
s if things have improved!
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.
see #2891 (comment) on removing unnecessary del
s.
But copy_tb
is possibly an exception since it no longer uses MultiError
.
# I don't know if this one can fail anymore, the `del` next to the comment that used to | ||
# refer to this only seems to break test_cancel_scope_exit_doesnt_create_cyclic_garbage |
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.
Same opinion here as for my other comment. Maybe others have a differing opinion, but rationally I think removing tests is good (though emotionally, not so much :'( ).
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.
@richardsheridan said in #2891 (review)
Hanging on to
test_simple_cancel_scope_usage_doesnt_create_cyclic_garbage
even though it maybe can't fail currently is fine IMO since we want to cover outcome and protect future refactoring.
I'd probably weakly be in favor of removing the test, but if not should probably update the comment to include sheridan's reasoning.
though concat_tb
is only used for collapse_exception_group
, which is only used for strict_exception_groups=False
, which we might deprecate soonish. So not sure there's much future refactoring to consider.
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.
Yeah updating the comment would be nice
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.
Ah oops, I mixed up the tests - the latter half of my previous comment pertains to test_ExceptionGroup_catch_doesnt_create_cyclic_garbage
.
Updated the comment though.
Co-authored-by: EXPLOSION <git@helvetica.moe>
The companion to #2886, see #2785
test_multierror
that could be retired.