Skip to content

webbrowser: fix compatibility with trio 0.25 #5895

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

Merged
merged 3 commits into from
Mar 17, 2024

Conversation

bastimeyer
Copy link
Member

See #5893

Breaking changes in trio's 0.25 release (apparently the last breaking change before their first stable release):
https://github.com/python-trio/trio/releases/tag/v0.25.0


  1. build: add exceptiongroup dependency
    Add the exceptiongroup dependency directly to Streamlink, so we can write ExceptionGroup handling code on all supported versions of Python without having to rely on trio's conditional dependency.
  2. webbrowser: fix compatibility with trio 0.25
    • Set min. version requirement of trio to 0.25,
      so we don't have to set strict_exception_groups to True on older versions (probably not even possible via pytest-trio)
    • Fix compatibility with trio>=0.25:
      Since strict_exception_groups now defaults to True, trio nurseries now always raise an ExceptionGroup in all cases, so update tests and handle exception groups instead. Don't unwrap exception groups for now, even if only a single exception is included.
      Explicitly handle KeyboardInterrupt/SystemExit and re-raise by using the exceptiongroup.catch utility (<py311 compat)
  3. plugins.twitch: update CI-token error handling

It's a bit annoying having to include the exceptiongroup dependency, but there's no other way around this. Python 3.11's except* syntax can't be used and making Python 3.11 the min requirement of the whole project because of this doesn't make sense. Python 3.10 reaches its EOL on 2026-10-31, so the added dependency will have to stay until then.


It'll probably make sense preparing a patch release because of these changes within the next couple of days, so we don't cause any unnecessary blockers on Linux distros where only the latest version gets packaged (e.g. Arch) - in case they will re-build packages depending on trio.

Add the `exceptiongroup` dependency directly to Streamlink, so we
can write `ExceptionGroup` handling code on all supported versions
of Python without having to rely on `trio`'s conditional dependency.
- Set min. version requirement of `trio` to `0.25`,
  so we don't have to set `strict_exception_groups` to `True` on older
  versions (probably not even possible via `pytest-trio`)
- Fix compatibility with `trio>=0.25`:
  Since `strict_exception_groups` now defaults to `True`, trio nurseries
  now always raise an `ExceptionGroup` in all cases, so update tests
  and handle exception groups instead. Don't unwrap exception groups
  for now, even if only a single exception is included.
  Explicitly handle `KeyboardInterrupt`/`SystemExit` and re-raise
  by using the `exceptiongroup.catch` utility (<py311 compat)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant