Skip to content

Sync typeshed #18880

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 7 commits into from
Apr 4, 2025
Merged

Sync typeshed #18880

merged 7 commits into from
Apr 4, 2025

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Apr 4, 2025

Source commit:
python/typeshed@616ca7d

This is the last typeshed commit with support for Python 3.8!

cdce8p and others added 7 commits April 4, 2025 14:42
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)
This was referenced Apr 4, 2025
Copy link
Contributor

github-actions bot commented Apr 4, 2025

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

beartype (https://github.com/beartype/beartype)
+ beartype/_data/hint/datahintpep.py:86: error: Unused "type: ignore" comment  [unused-ignore]
+ beartype/_data/hint/datahintpep.py:137: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:137: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:145: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:145: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:152: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:152: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:163: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:163: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:170: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:170: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:177: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:177: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:184: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:184: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:191: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:191: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:198: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:198: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:210: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:210: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_data/hint/datahintpep.py:217: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_data/hint/datahintpep.py:217: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep647742.py:32: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep647742.py:32: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep585.py:43: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep585.py:43: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep585.py:82: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep585.py:82: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep585.py:140: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep585.py:140: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep585.py:173: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep585.py:173: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep585.py:214: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep585.py:214: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep585.py:324: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep585.py:324: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- beartype/_util/hint/pep/proposal/pep557.py:81: error: Unused "type: ignore" comment  [unused-ignore]
+ beartype/_util/hint/pep/proposal/pep585.py:389: error: Item "type" of "type | None" has no attribute "__orig_bases__"  [union-attr]
+ beartype/_util/hint/pep/proposal/pep585.py:389: error: Item "None" of "type | None" has no attribute "__orig_bases__"  [union-attr]
+ beartype/_util/hint/pep/proposal/pep585.py:395: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep585.py:395: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep585.py:518: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep585.py:518: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep557.py:22: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep557.py:22: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep557.py:27: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep557.py:27: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/pep484585container.py:27: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484585/pep484585container.py:27: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/pep484585container.py:60: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484585/pep484585container.py:60: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/pep484585.py:23: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484585/pep484585.py:23: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/pep484585.py:67: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484585/pep484585.py:67: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484/pep484union.py:25: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484/pep484union.py:25: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:27: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:27: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:38: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:38: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:69: error: Hint? has no attribute "__module__"  [attr-defined]
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:69: error: Hint? has no attribute "__qualname__"  [attr-defined]
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:113: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:113: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:158: error: Hint? has no attribute "__supertype__"  [attr-defined]
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:171: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:171: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484/pep484generic.py:28: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484/pep484generic.py:28: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484/pep484generic.py:75: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484/pep484generic.py:75: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/nonpep/api/utilmodpandera.py:26: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/nonpep/api/utilmodpandera.py:26: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/metadata/metasane.py:79: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/metadata/metasane.py:79: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/metadata/metasane.py:102: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/metadata/metasane.py:102: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/metadata/metasane.py:176: error: Unsupported left operand type for == (Hint?)  [operator]
+ beartype/_check/metadata/metasane.py:234: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/metadata/metasane.py:234: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/metadata/metasane.py:241: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/metadata/metasane.py:241: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/metadata/metasane.py:288: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/metadata/metasane.py:288: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/metadata/metasane.py:312: error: Item Hint? of "Hint? | HintSanifiedData" has no attribute "hint"  [union-attr]
+ beartype/_check/metadata/metasane.py:365: error: Item Hint? of "Hint? | HintSanifiedData" has no attribute "hint"  [union-attr]
+ beartype/_check/metadata/metasane.py:369: error: Item Hint? of "Hint? | HintSanifiedData" has no attribute "typevar_to_hint"  [union-attr]
+ beartype/_check/metadata/metasane.py:373: error: Item Hint? of "Hint? | HintSanifiedData" has no attribute "typevar_to_hint"  [union-attr]
+ beartype/_check/metadata/metasane.py:387: error: Item Hint? of "Hint? | HintSanifiedData" has no attribute "typevar_to_hint"  [union-attr]
+ beartype/_check/metadata/hint/hintmeta.py:134: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/metadata/hint/hintmeta.py:134: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/metadata/hint/hintmeta.py:171: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/metadata/hint/hintmeta.py:171: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/convert/_reduce/_pep/redpep673.py:24: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/convert/_reduce/_pep/redpep673.py:24: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/convert/_reduce/_pep/redpep593.py:23: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/convert/_reduce/_pep/redpep593.py:23: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/convert/_reduce/_pep/redpep589.py:22: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/convert/_reduce/_pep/redpep589.py:22: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/convert/_reduce/_pep/pep484/redpep484.py:25: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/convert/_reduce/_pep/pep484/redpep484.py:25: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_check/convert/_reduce/_pep/pep484/redpep484.py:110: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_check/convert/_reduce/_pep/pep484/redpep484.py:110: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/pep484585func.py:49: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484585/pep484585func.py:49: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/pep484585func.py:106: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
- beartype/_util/hint/pep/proposal/pep484585/pep484585func.py:106: error: Unused "type: ignore" comment  [unused-ignore]
+ beartype/_util/hint/pep/proposal/pep484585/pep484585func.py:106: note: Error code "valid-type" not covered by "type: ignore" comment
+ beartype/_util/hint/pep/proposal/pep484585/pep484585func.py:106: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/generic/pep484585gentest.py:31: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484585/generic/pep484585gentest.py:31: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/generic/pep484585gentest.py:87: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484585/generic/pep484585gentest.py:87: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/generic/pep484585gentest.py:160: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]
+ beartype/_util/hint/pep/proposal/pep484585/generic/pep484585gentest.py:160: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ beartype/_util/hint/pep/proposal/pep484585/generic/pep484585gentest.py:209: error: Variable "typing_extensions.TypeForm" is not valid as a type  [valid-type]

... (truncated 151 lines) ...

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/server/events/actions.py:101: error: Unsupported left operand type for | ("<typing special form>")  [operator]
+ src/prefect/server/events/actions.py:101: error: Unsupported left operand type for | ("type[Any]")  [operator]

altair (https://github.com/vega/altair)
+ tests/vegalite/v5/test_theme.py:1073: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/vegalite/v5/test_theme.py:1074: error: Unused "type: ignore" comment  [unused-ignore]

steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/commands/converters.py:510: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "type[T]")  [assignment]
+ steam/ext/commands/converters.py:510: error: Incompatible types in assignment (expression has type "type[Any]", variable has type "type[T]")  [assignment]

mypy (https://github.com/python/mypy)
+ mypy/stubgenc.py:768: error: Unused "type: ignore" comment  [unused-ignore]

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_writer.py:101: error: Unused "type: ignore" comment  [unused-ignore]
+ aiohttp/http_writer.py:120: error: Unused "type: ignore" comment  [unused-ignore]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/config.py:631: error: Unused "type: ignore" comment  [unused-ignore]

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/structured_configs/_implementations.py:3252: error: List comprehension has incompatible type List[tuple[str, Any | <typing special form>, Any | Field[Any]]]; expected List[tuple[str, type] | tuple[str, type, Any]]  [misc]

ibis (https://github.com/ibis-project/ibis)
- ibis/expr/operations/__init__.py:13: error: Incompatible import of "Any" (imported name has type "type[ibis.expr.operations.reductions.Any]", local name has type "<typing special form>")  [assignment]
+ ibis/expr/operations/__init__.py:13: error: Incompatible import of "Any" (imported name has type "type[ibis.expr.operations.reductions.Any]", local name has type "type[typing.Any]")  [assignment]
- ibis/expr/types/logical.py:333: error: "<typing special form>" not callable  [operator]
+ ibis/expr/types/logical.py:333: error: Too many arguments for "Any"  [call-arg]
+ ibis/expr/types/logical.py:333: error: Unexpected keyword argument "where" for "Any"  [call-arg]
+ note: "Any" defined here
+ ibis/expr/types/logical.py:340: error: "Any" has no attribute "to_expr"  [attr-defined]
- ibis/backends/polars/compiler.py:750: error: No overload variant of "register" of "_SingleDispatchCallable" matches argument types "object", "Callable[[Any, KwArg(Any)], Any]"  [call-overload]
- ibis/backends/polars/compiler.py:750: note: Possible overload variants:
- ibis/backends/polars/compiler.py:750: note:     def register(self, cls: type[Any] | UnionType, func: None = ...) -> Callable[[Callable[..., Any]], Callable[..., Any]]
- ibis/backends/polars/compiler.py:750: note:     def register(self, cls: Callable[..., Any], func: None = ...) -> Callable[..., Any]
- ibis/backends/polars/compiler.py:750: note:     def register(self, cls: type[Any] | UnionType, func: Callable[..., Any]) -> Callable[..., Any]

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/recwarn.py:170: error: Unused "type: ignore" comment  [unused-ignore]
+ src/_pytest/recwarn.py:229: error: Return type "WarningsRecorder" of "__enter__" incompatible with return type "Optional[list[WarningMessage]]" in supertype "catch_warnings"  [override]

artigraph (https://github.com/artigraph/artigraph)
- src/arti/internal/type_hints.py:54: error: Non-overlapping identity check (left operand type: "type", right operand type: "<typing special form>")  [comparison-overlap]
- src/arti/internal/type_hints.py:55: error: Non-overlapping identity check (left operand type: "type", right operand type: "<typing special form>")  [comparison-overlap]

@cdce8p
Copy link
Collaborator Author

cdce8p commented Apr 4, 2025

@JelleZijlstra JelleZijlstra merged commit 772187f into python:master Apr 4, 2025
19 checks passed
@cdce8p cdce8p deleted the sync-typeshed branch April 4, 2025 18:03
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