-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
webbrowser: fix propagation of BaseException #5930
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
webbrowser: fix propagation of BaseException #5930
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
53afcbb
to
e5d03cb
Compare
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've tested this commit on Debian Stable and tests are passing 👍
client_integrity = CDPClient.launch( | ||
session, | ||
acquire_client_integrity_token, | ||
# headless mode gets detected by Twitch, so we have to disable it regardless the user config | ||
headless=False, | ||
) | ||
except BaseExceptionGroup: |
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.
On recent python version, if there is a single exception, will this still catch it if the BaseExceptionGroup is unwraped ?
I'm not sure if this can really happen though as tests are passing.
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.
trio.run()
is called with strict_exception_groups=True
, so only exception groups can be raised from trio.Nursery
contexts. That was the whole reason why trio's 0.25 was a breaking change for us and why we now have to set this argument explicitly on older versions of trio.
There are a couple of cases though where we actually want to catch and log non-group exceptions and then continue running the plugin code without retrieving the client-integrity token, namely resolve_executable()
, find_free_port_ipv4()
, tempfile.TemporaryDirectory()
, etc. Let me fix this real quick...
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.
Indeed I forgot that strict_exception_groups=True
option, thanks for the explanation.
Still good on Debian Stable with 0cc9f86.
- Fix `KeyboardInterrupt`/`SystemExit` exceptions not being propagated in nested `ExceptionGroup`s - Fix compatibility with `exceptiongroup<=1.1.1` by avoiding their `catch()` context manager - Add missing test for (re-)raising different exception types
e5d03cb
to
0cc9f86
Compare
KeyboardInterrupt
/SystemExit
exceptions not being propagated in nestedExceptionGroup
sexceptiongroup<=1.1.1
by avoiding theircatch()
context managerFixes #5929
exceptiongroup>=1.1.2
fixed their incorrect behavior of raising anExceptionGroup
when raising non-group-exceptions in the callback function passed to theircatch()
context manager:https://github.com/agronholm/exceptiongroup/blob/1.1.2/CHANGES.rst
Due to this change, we can't use the
catch()
context manager anymore and we need to catch allBaseExceptionGroup
s instead and get a sub-group of the exceptions we're looking for.