-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6fbc908
commit 7f79fb1
Showing
4 changed files
with
49 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
-e . | ||
|
||
# Compatibility testing. | ||
anyio~=3.2; python_version<'3.11' | ||
|
||
# Packaging. | ||
twine | ||
wheel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import sys | ||
from contextlib import contextmanager | ||
from typing import Generator | ||
|
||
has_exceptiongroups = True | ||
|
||
if sys.version_info < (3, 11): # pragma: no cover | ||
try: | ||
from exceptiongroup import BaseExceptionGroup | ||
except ImportError: | ||
has_exceptiongroups = False | ||
|
||
|
||
@contextmanager | ||
def collapse_excgroups() -> Generator[None, None, None]: | ||
try: | ||
yield | ||
except BaseException as exc: | ||
if has_exceptiongroups: | ||
while isinstance(exc, BaseExceptionGroup) and len(exc.exceptions) == 1: | ||
exc = exc.exceptions[0] | ||
|
||
raise exc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters