-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Sync typeshed #16863
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
Sync typeshed #16863
Conversation
Source commit: python/typeshed@5ce34dc
This comment has been minimized.
This comment has been minimized.
This is allegedly causing large performance problems, see 13821 typeshed/8231 had zero hits on mypy_primer, so it's not the worst thing to undo. Patching this in typeshed also feels weird, since there's a more general soundness issue. If a typevar has a bound or constraint, we might not want to solve it to a Literal. If we can confirm the performance regression or fix the unsoundness within mypy, I might pursue upstreaming this in typeshed. (Reminder: add this to the sync_typeshed script once merged)
Since the plugin provides superior type checking: python#13987 (comment) A manual cherry-pick of e437cdf.
9cd74ef
to
6e2dbe6
Compare
Diff from mypy_primer, showing the effect of this PR on open source code: steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/tf2/currency.py:100: note: Superclass:
- steam/ext/tf2/currency.py:100: note: @overload
- steam/ext/tf2/currency.py:100: note: def __sub__(a, int | Fraction, /) -> Fraction
- steam/ext/tf2/currency.py:100: note: @overload
- steam/ext/tf2/currency.py:100: note: def __sub__(a, float, /) -> float
- steam/ext/tf2/currency.py:100: note: @overload
- steam/ext/tf2/currency.py:100: note: def __sub__(a, complex, /) -> complex
- steam/ext/tf2/currency.py:100: note: Subclass:
- steam/ext/tf2/currency.py:100: note: def __sub__(self, int | str | float | Fraction | Decimal, /) -> Metal
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/python_api.py:397: error: Unused "type: ignore" comment [unused-ignore]
+ src/_pytest/python_api.py:441: error: Unused "type: ignore" comment [unused-ignore]
+ src/_pytest/python_api.py:442: error: Unused "type: ignore" comment [unused-ignore]
+ src/_pytest/python_api.py:450: error: Unused "type: ignore" comment [unused-ignore]
+ src/_pytest/python_api.py:454: error: Argument 1 to "abs" has incompatible type "SupportsComplex | complex"; expected "SupportsAbs[float]" [arg-type]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:168: error: Argument 1 to "abs" has incompatible type "SupportsComplex | complex"; expected "SupportsAbs[float]" [arg-type]
+ ibis/util.py:168: error: Unsupported operand types for < ("float" and "Real") [operator]
- ibis/common/temporal.py:184: error: Incompatible return value type (got "int", expected "timedelta") [return-value]
- ibis/common/temporal.py:184: error: Argument 1 to "int" has incompatible type "timedelta | Real"; expected "str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc" [arg-type]
+ ibis/common/temporal.py:184: error: No overload variant of "int" matches argument type "timedelta | Real" [call-overload]
+ ibis/common/temporal.py:184: note: Possible overload variants:
+ ibis/common/temporal.py:184: note: def __new__(cls, str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc = ..., /) -> int
+ ibis/common/temporal.py:184: note: def __new__(cls, str | bytes | bytearray, /, base: SupportsIndex) -> int
|
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.
LGTM, thanks! The primer diff is all from python/typeshed#11353 — see my analysis of the diff in python/typeshed#11353 (comment). TL;DR — it's impossible to type the numbers
module properly, but this seems like it's probably a net improvement for users
Unfortunately, since the last typeshed update was squash merged, we're unable to update the commit hashes in
misc/sync-typeshed.py
to prevent further conflicts.Source commit: python/typeshed@5ce34dc
misc/sync-typeshed.py
script.