Skip to content

Commit 929bf75

Browse files
authored
conditionally require exceptiongroup (#183)
also: add python 3.12 and pypy3.9, 3.10 to CI
1 parent 326298b commit 929bf75

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ on:
66
- master
77
pull_request:
88

9+
# pylint crashes on 3.12 due to https://github.com/pylint-dev/astroid/issues/2201
10+
# see https://github.com/pylint-dev/pylint/issues/8782
911
jobs:
1012
build_and_test_pinned:
1113
runs-on: ${{ matrix.os }}
1214
strategy:
1315
matrix:
1416
os: [ubuntu-latest]
15-
python-version: ['3.7', '3.8', '3.9', '3.10']
17+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
1618

1719
steps:
1820
- uses: actions/checkout@v3
@@ -52,7 +54,7 @@ jobs:
5254
strategy:
5355
matrix:
5456
os: [ubuntu-latest]
55-
python-version: ['pypy-3.7']
57+
python-version: ['pypy-3.9','pypy-3.10']
5658

5759
steps:
5860
- uses: actions/checkout@v3
@@ -70,7 +72,7 @@ jobs:
7072
strategy:
7173
matrix:
7274
os: [ubuntu-latest]
73-
python-version: ['3.11']
75+
python-version: ['3.12-dev']
7476
steps:
7577
- uses: actions/checkout@v3
7678
- name: Setup Python

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ click==8.1.3
2020
# via pip-tools
2121
coverage[toml]==7.2.1
2222
# via pytest-cov
23-
cryptography==39.0.2
23+
cryptography==41.0.4
2424
# via trustme
2525
exceptiongroup==1.1.0
2626
# via

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
'Programming Language :: Python :: 3.9',
3434
'Programming Language :: Python :: 3.10',
3535
'Programming Language :: Python :: 3.11',
36+
'Programming Language :: Python :: 3.12',
3637
'Programming Language :: Python :: Implementation :: CPython',
3738
'Programming Language :: Python :: Implementation :: PyPy',
3839
],
3940
python_requires=">=3.7",
4041
keywords='websocket client server trio',
4142
packages=find_packages(exclude=['docs', 'examples', 'tests']),
4243
install_requires=[
43-
'exceptiongroup',
44+
'exceptiongroup; python_version<"3.11"',
4445
'trio>=0.11',
4546
'wsproto>=0.14',
4647
],

trio_websocket/_impl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import trio
1515
import trio.abc
16-
from exceptiongroup import BaseExceptionGroup
1716
from wsproto import ConnectionType, WSConnection
1817
from wsproto.connection import ConnectionState
1918
import wsproto.frame_protocol as wsframeproto
@@ -30,6 +29,10 @@
3029
)
3130
import wsproto.utilities
3231

32+
if sys.version_info < (3, 11): # pragma: no cover
33+
# pylint doesn't care about the version_info check, so need to ignore the warning
34+
from exceptiongroup import BaseExceptionGroup # pylint: disable=redefined-builtin
35+
3336
_TRIO_MULTI_ERROR = tuple(map(int, trio.__version__.split('.')[:2])) < (0, 22)
3437

3538
CONN_TIMEOUT = 60 # default connect & disconnect timeout, in seconds
@@ -65,7 +68,7 @@ def __exit__(self, ty, value, tb):
6568
if value is None or not self._armed:
6669
return False
6770

68-
if _TRIO_MULTI_ERROR:
71+
if _TRIO_MULTI_ERROR: # pragma: no cover
6972
filtered_exception = trio.MultiError.filter(_ignore_cancel, value) # pylint: disable=no-member
7073
elif isinstance(value, BaseExceptionGroup):
7174
filtered_exception = value.subgroup(lambda exc: not isinstance(exc, trio.Cancelled))

0 commit comments

Comments
 (0)