Skip to content

Commit 9ad2774

Browse files
committed
Use exceptiongroup library instead of trio.MultiError
1 parent 0a64a32 commit 9ad2774

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ dependencies = [
3838
"quart~=0.19.4",
3939
"quart-trio~=0.11.1",
4040
"trio~=0.23.1",
41-
"Werkzeug~=3.0.1"
41+
"Werkzeug~=3.0.1",
42+
'exceptiongroup >= 1.2.0; python_version < "3.11"',
4243
]
4344

4445
[tool.setuptools.dynamic]

src/sanescansrv/server.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@
6565

6666
Handler = TypeVar("Handler", bound=Callable[..., Awaitable[object]])
6767

68-
if sys.version_info >= (3, 11):
69-
BaseExceptionGroup_ = BaseExceptionGroup
70-
else:
71-
BaseExceptionGroup_ = trio.MultiError
68+
if sys.version_info < (3, 11):
69+
from exceptiongroup import BaseExceptionGroup
7270

7371

7472
def stop_sane() -> None:
@@ -642,7 +640,7 @@ def serve_scanner(
642640
print(f"Serving on http://{location}\n(CTRL + C to quit)")
643641

644642
trio.run(serve_async, app, config_obj)
645-
except BaseExceptionGroup_ as exc:
643+
except BaseExceptionGroup as exc:
646644
caught = False
647645
for ex in exc.exceptions:
648646
if isinstance(ex, KeyboardInterrupt):

0 commit comments

Comments
 (0)