Skip to content

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

Merged
merged 5 commits into from
Feb 3, 2024
Merged

Sync typeshed #16863

merged 5 commits into from
Feb 3, 2024

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Feb 3, 2024

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

⚠️ Remember to use "rebase and merge" rather than "squash and merge" for this PR, so that we can easily update the commit hashes to cherry-pick in the misc/sync-typeshed.py script. ⚠️

This comment has been minimized.

hauntsaninja and others added 4 commits February 3, 2024 11:46
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.
@cdce8p cdce8p force-pushed the mypybot/sync-typeshed branch from 9cd74ef to 6e2dbe6 Compare February 3, 2024 10:47
Copy link
Contributor

github-actions bot commented Feb 3, 2024

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

Copy link
Member

@AlexWaygood AlexWaygood left a 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

@cdce8p cdce8p requested a review from JelleZijlstra February 3, 2024 15:20
@JelleZijlstra JelleZijlstra merged commit 0dd4b6f into python:master Feb 3, 2024
@cdce8p cdce8p deleted the mypybot/sync-typeshed branch February 3, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants