Skip to content
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 (for 1.9 release) #16844

Merged
merged 7 commits into from
Feb 2, 2024
Merged

Conversation

jhance
Copy link
Collaborator

@jhance jhance commented Jan 31, 2024

No description provided.

jhance and others added 5 commits January 31, 2024 12:25
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.

This comment has been minimized.

@jhance
Copy link
Collaborator Author

jhance commented Jan 31, 2024

I think mypy primer looks alright... I know there was some changes internal to CodeType recently (as I saw it in 3.11) so I'm guessing thats why.

@jhance
Copy link
Collaborator Author

jhance commented Jan 31, 2024

It looks like we need to remove support for --python-version 3.7 since typeshed dropped support for 3.7. Seems reasonable?

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Jan 31, 2024

yeah, jinja CodeType is from dropping 3.7 python/typeshed#11238
steam.py is from python/typeshed#11347 which seems little unfortunate

@AlexWaygood
Copy link
Member

steam.py is from python/typeshed#11347 which seems little unfortunate

I filed python/typeshed#11353, which fixes that

Comment on lines 1568 to 1571
[case testTypingOrderedDictAlias]
# flags: --python-version 3.7
from typing import OrderedDict
x: OrderedDict[str, int] = OrderedDict({})
reveal_type(x)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably fail. The output line will need to be changed from 4 to 3.
Can't do a suggestion for that line, unfortunately.

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Feb 1, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

anyio (https://github.com/agronholm/anyio)
+ src/anyio/_backends/_asyncio.py:1654: error: Unused "type: ignore" comment  [unused-ignore]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/debug.py:130: error: Argument 6 to "CodeType" has incompatible type "bytes"; expected "int"  [arg-type]
+ src/jinja2/debug.py:131: error: Argument 7 to "CodeType" has incompatible type "Tuple[Any, ...]"; expected "bytes"  [arg-type]
+ src/jinja2/debug.py:134: error: Argument 10 to "CodeType" has incompatible type "str"; expected "Tuple[str, ...]"  [arg-type]
+ src/jinja2/debug.py:136: error: Argument 12 to "CodeType" has incompatible type "int"; expected "str"  [arg-type]
+ src/jinja2/debug.py:137: error: Argument 13 to "CodeType" has incompatible type "bytes"; expected "int"  [arg-type]
+ src/jinja2/debug.py:138: error: Argument 14 to "CodeType" has incompatible type "Tuple[str, ...]"; expected "bytes"  [arg-type]
+ src/jinja2/ext.py:297: error: Incompatible redefinition (redefinition with type "Callable[[Arg(str, 'c'), Arg(str, 's')], str]", original type "Callable[[Arg(str, 'context'), Arg(str, 'message')], str]")  [misc]
+ src/jinja2/ext.py:304: error: Incompatible redefinition (redefinition with type "Callable[[Arg(str, 'c'), Arg(str, 's'), Arg(str, 'p'), Arg(int, 'n')], str]", original type "Callable[[Arg(str, 'context'), Arg(str, 'msgid1'), Arg(str, 'msgid2'), Arg(int, 'n')], str]")  [misc]

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/calls.py:108: error: "Future" has no attribute "_condition"  [attr-defined]
- src/prefect/server/orchestration/rules.py:102: error: Incompatible types in assignment (expression has type "ellipsis", variable has type "Session | AsyncSession | None")  [assignment]
+ src/prefect/server/orchestration/rules.py:102: error: Incompatible types in assignment (expression has type "EllipsisType", variable has type "Session | AsyncSession | None")  [assignment]
- src/prefect/server/orchestration/rules.py:103: error: Incompatible types in assignment (expression has type "ellipsis", variable has type "State[Any] | None")  [assignment]
+ src/prefect/server/orchestration/rules.py:103: error: Incompatible types in assignment (expression has type "EllipsisType", variable has type "State[Any] | None")  [assignment]
- src/prefect/server/orchestration/rules.py:104: error: Incompatible types in assignment (expression has type "ellipsis", variable has type "State[Any] | None")  [assignment]
+ src/prefect/server/orchestration/rules.py:104: error: Incompatible types in assignment (expression has type "EllipsisType", variable has type "State[Any] | None")  [assignment]

spack (https://github.com/spack/spack)
+ lib/spack/spack/install_test.py:520: error: Unused "type: ignore" comment  [unused-ignore]
+ lib/spack/spack/install_test.py:522: error: Unused "type: ignore" comment  [unused-ignore]

trio (https://github.com/python-trio/trio)
+ src/trio/_socket.py:378: error: Unused "type: ignore" comment  [unused-ignore]

@AlexWaygood
Copy link
Member

steam.py is from python/typeshed#11347 which seems little unfortunate

I filed python/typeshed#11353, which fixes that

(This has now been merged into typeshed's main branch)

@JukkaL JukkaL merged commit 67c3969 into python:master Feb 2, 2024
18 checks passed
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.

None yet

5 participants