-
-
Notifications
You must be signed in to change notification settings - Fork 955
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
Upgraded to AnyIO 4.0 #2211
Merged
Merged
Upgraded to AnyIO 4.0 #2211
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5c41699
Upgraded to AnyIO 4.0 and dropped Python 3.8 support
agronholm 026ced3
Added conditional imports for ExceptionGroup
agronholm 67e5a41
Fixed mypy errors
agronholm df70155
Fixed black errors
agronholm e42480f
Fixed last failure
agronholm b9f27e4
Added missing test dependency
agronholm 9568e8e
Exclude "raise" in handle_assertion_error() from coverage
agronholm aa3874c
Exclude conditional import from coverage
agronholm 6c71321
Simplified the changes
agronholm 7225f96
Fixed linting errors
agronholm 1e9096d
Dropped exceptiongroup as a test dependency
agronholm e1becdb
Restored compatibility with AnyIO 3.x
agronholm ac67df8
Fixed mypy errors
agronholm 86fdcbf
Fixed linting errors
agronholm efe6cf5
Merge branch 'master' into anyio4
agronholm efef252
Merge branch 'master' into anyio4
agronholm 9773d06
Use general ABCs for object stream type annotations for consistency
agronholm 053b96b
Moved convert_excgroups() from tests to the main code base
agronholm 68cc1a8
Updated anyio dependency to point to master
agronholm ef5f16a
Fixed linting error
agronholm cb6008b
Ignore coverage for a conditional import
agronholm fcb9056
Moved the exception group converter to middleware/base.py
agronholm c1454cf
Removed unnecessary imports
agronholm 07ceb21
Fixed import errors
agronholm 2dc718e
Merge branch 'master' into anyio4
Kludex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,19 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
from collections.abc import Generator | ||
from contextlib import contextmanager | ||
|
||
if sys.version_info < (3, 11): # pragma: no cover | ||
from exceptiongroup import BaseExceptionGroup | ||
|
||
|
||
@contextmanager | ||
def convert_excgroups() -> Generator[None, None, None]: | ||
try: | ||
yield | ||
except BaseException as exc: | ||
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
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 |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
|
||
from starlette.middleware.wsgi import WSGIMiddleware, build_environ | ||
|
||
from ..exc_converter import convert_excgroups | ||
|
||
|
||
def hello_world(environ, start_response): | ||
status = "200 OK" | ||
|
@@ -66,7 +68,7 @@ def test_wsgi_exception(test_client_factory): | |
# The HTTP protocol implementations would catch this error and return 500. | ||
app = WSGIMiddleware(raise_exception) | ||
client = test_client_factory(app) | ||
with pytest.raises(RuntimeError): | ||
with pytest.raises(RuntimeError), convert_excgroups(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use the |
||
client.get("/") | ||
|
||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'd prefer if we maintain the tests unchanged, and unpack the
ExceptionGroup
on theBaseHTTPMiddleware
in case we have a single exception.