Fix return type of start_tls()#10346
Merged
AlexWaygood merged 2 commits intopython:mainfrom Jun 28, 2023
Dreamsorcerer:patch-27
Merged
Fix return type of start_tls()#10346AlexWaygood merged 2 commits intopython:mainfrom Dreamsorcerer:patch-27
AlexWaygood merged 2 commits intopython:mainfrom
Dreamsorcerer:patch-27
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:1066: error: Argument 1 to "connection_made" of "BaseProtocol" has incompatible type "Optional[Transport]"; expected "BaseTransport" [arg-type]
+ aiohttp/connector.py:1069: error: Incompatible return value type (got "Tuple[Optional[Transport], ResponseHandler]", expected "Tuple[BaseTransport, ResponseHandler]") [return-value]
|
Contributor
Author
|
mypy_primer highlights the bug. |
Contributor
Author
|
I've opened a cpython bug report, maybe this should be considered a bug rather than incorrect typing: |
Member
Let's wait for the asyncio experts over at CPython to decide whether or not it's a bug in CPython before we merge this 👍 |
Member
|
The CPython docs PR has been merged, so I'm fan with landing this now. Thanks! |
This was referenced Jul 9, 2023
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This just returns
_app_transport:https://github.com/python/cpython/blob/dba72175116373c1d15e25d84c88b516daf9f5c4/Lib/asyncio/base_events.py#L1288
Which will be set to
Noneon init and after connection lost:https://github.com/python/cpython/blob/dba72175116373c1d15e25d84c88b516daf9f5c4/Lib/asyncio/sslproto.py#L412
Related bug report:
aio-libs/aiohttp#3355