-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Import Protocol
from typing_extensions
#5111
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5111 +/- ##
==========================================
- Coverage 97.51% 97.46% -0.06%
==========================================
Files 43 43
Lines 8824 8821 -3
Branches 1415 1414 -1
==========================================
- Hits 8605 8597 -8
- Misses 102 105 +3
- Partials 117 119 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Conditional imports must reference `sys.version_info` directly for type checkers to be able to narrow them. If a type checker cannot tell whether `PY_38` is true, it will combine the imports from both clauses in a `Union`. However, `typing.Protocol` and `typing_extensions.Protocol` are incompatible with each other - they do not inherit from the same class. This produces a type error which is reported to users of aiohttp depending on their type checking configuration.
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.
Thanks!
💔 Backport was not successfulThe PR was attempted backported to the following branches:
|
Conditional imports must reference `sys.version_info` directly for type checkers to be able to narrow them. If a type checker cannot tell whether `PY_38` is true, it will combine the imports from both clauses in a `Union`. However, `typing.Protocol` and `typing_extensions.Protocol` are incompatible with each other - they do not inherit from the same class. This produces a type error which is reported to users of aiohttp depending on their type checking configuration.. (cherry picked from commit fb8037a) Co-authored-by: layday <31134424+layday@users.noreply.github.com>
Conditional imports must reference `sys.version_info` directly for type checkers to be able to narrow them. If a type checker cannot tell whether `PY_38` is true, it will combine the imports from both clauses in a `Union`. However, `typing.Protocol` and `typing_extensions.Protocol` are incompatible with each other - they do not inherit from the same class. This produces a type error which is reported to users of aiohttp depending on their type checking configuration.. (cherry picked from commit fb8037a) Co-authored-by: layday <31134424+layday@users.noreply.github.com> Co-authored-by: layday <31134424+layday@users.noreply.github.com>
What do these changes do?
Conditional imports must reference
sys.version_info
directlyfor type checkers to be able to narrow them. If a type checker
cannot tell whether
PY_38
is true, it will combine the importsfrom both clauses in a
Union
.However,
typing.Protocol
andtyping_extensions.Protocol
areincompatible with each other - they do not inherit from the same class.
This produces a type error which is reported to users of aiohttp
depending on their type checking configuration.
Are there changes in behavior for the user?
No.
Related issue number
—
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.