-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fixed bare raise
and exception chaining when a handler raises an exception
#71
Conversation
258eaad
to
3fe4284
Compare
Pull Request Test Coverage Report for Build 5810639052
💛 - Coveralls |
3fe4284
to
f1d3db5
Compare
@@ -153,6 +153,21 @@ def handler(exc): | |||
raise ExceptionGroup("booboo", [ValueError("bar")]) | |||
|
|||
|
|||
def test_catch_handler_reraises(): | |||
def handler(exc): | |||
raise |
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.
Can you add a test with raise Exception
and make sure the __context__
is set to the split exception group
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 __context__
value is the same as __cause__
on py3.11 though?
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 it seems that in the backport, __context__
is set to the split exception group which doesn't match the py3.11 test which I just augmented.
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 made sure that the back-port works the same way as py3.11 does.
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.
As usual, I misread your comment. I'll make sure to add such a test.
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.
Well, this was interesting. Contrary to my expectations, the exception group in __context__
on py3.11 was a copy of the original, so assert exc.value.__context__ is excgrp
failed.
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'm not sure that it's essential to copy the exception group. I stopped just short of doing that, as didn't think it's worth the effort to change the context to a copy.
Fixes #70.