-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
add types.GenericAlias.__mro_entries__
#13284
Conversation
This comment has been minimized.
This comment has been minimized.
steam.py has a custom subclass of GenericAlias which defines a |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Sebastian Rittau <[email protected]>
Diff from mypy_primer, showing the effect of this PR on open source code: steam.py (https://github.com/Gobot1234/steam.py)
+ steam/trade.py:189: error: Argument 1 of "__mro_entries__" is incompatible with supertype "GenericAlias"; supertype defines the argument type as "Iterable[object]" [override]
+ steam/trade.py:189: note: This violates the Liskov substitution principle
+ steam/trade.py:189: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
schemathesis (https://github.com/schemathesis/schemathesis)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
|
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!
I used
Iterable[object]
because it matches the call signature ofresolve_bases
, but it could just as easily beAny
because the specific implementation here doesn't look at the argument and always returns a 1-tuple of the__origin__
attribute.