Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Jun 1, 2025

Sync typeshed

Source commit:
python/typeshed@5a3c495

Note that you will need to close and re-open the PR in order to trigger CI.

mypybot and others added 6 commits June 1, 2025 00:08
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)
@github-actions github-actions bot force-pushed the mypybot/sync-typeshed branch from 760f5d1 to 99dcf32 Compare June 1, 2025 00:08
@JelleZijlstra
Copy link
Member

@hauntsaninja did you forget to reopen?

@JelleZijlstra JelleZijlstra reopened this Jun 1, 2025
@hauntsaninja
Copy link
Collaborator

My intention was to re-open yes, not sure what happened between my brain my fingers and github

@github-actions
Copy link
Contributor Author

github-actions bot commented Jun 1, 2025

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

antidote (https://github.com/Finistere/antidote): 1.23x slower (72.0s -> 88.5s in single noisy sample)

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/utilities/callables.py:655: error: Incompatible return value type (got "Union[str, bytes, int, float, complex, ellipsis, None]", expected "Optional[str]")  [return-value]
+ src/prefect/utilities/_ast.py:104: error: Dict entry 0 has incompatible type "str": "Union[str, bytes, int, float, complex, ellipsis, None]"; expected "str": "str"  [dict-item]

ibis (https://github.com/ibis-project/ibis)
+ ibis/common/annotations.py:450: note:     def update(self, SupportsKeysAndGetItem[Any, Any], /) -> None
- ibis/common/annotations.py:450: note:     def update(self, SupportsKeysAndGetItem[Any, Any], /, **kwargs: Any) -> None
+ ibis/common/annotations.py:450: note:     def update(self, SupportsKeysAndGetItem[str, Any], /, **kwargs: Any) -> None
+ ibis/common/annotations.py:450: note:     def update(self, Iterable[tuple[Any, Any]], /) -> None
- ibis/common/annotations.py:450: note:     def update(self, Iterable[tuple[Any, Any]], /, **kwargs: Any) -> None
+ ibis/common/annotations.py:450: note:     def update(self, Iterable[tuple[str, Any]], /, **kwargs: Any) -> None

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/son.py:146: error: Unused "type: ignore" comment  [unused-ignore]

materialize (https://github.com/MaterializeInc/materialize): 1.05x slower (139.3s -> 146.8s in single noisy sample)

scikit-build-core (https://github.com/scikit-build/scikit-build-core): 1.08x slower (49.1s -> 53.2s in single noisy sample)

mypy (https://github.com/python/mypy)
+ mypy/fastparse.py:2063: error: Statement is unreachable  [unreachable]
+ mypy/fastparse.py:2063: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-unreachable for more info

pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/dataclasses.py:214: error: Incompatible types in assignment (expression has type "type[Any]", variable has type "DataclassProxy")  [assignment]
- pydantic/v1/dataclasses.py:214: error: No overload variant of "dataclass" matches argument types "type[Any]", "bool", "bool", "bool", "bool", "bool", "bool", "bool"  [call-overload]
- pydantic/v1/dataclasses.py:214: note: Possible overload variants:
- pydantic/v1/dataclasses.py:214: note:     def dataclass(None, /) -> Callable[[type[_T]], type[_T]]
- pydantic/v1/dataclasses.py:214: note:     def [_T] dataclass(type[_T], /) -> type[_T]
- pydantic/v1/dataclasses.py:214: note:     def dataclass(*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ..., match_args: bool = ..., kw_only: bool = ..., slots: bool = ..., weakref_slot: bool = ...) -> Callable[[type[_T]], type[_T]]
+ pydantic/dataclasses.py:257: error: Unused "type: ignore" comment  [unused-ignore]

operator (https://github.com/canonical/operator)
+ ops/model.py:1960: note:          def update(self, SupportsKeysAndGetItem[str, str], /) -> None
+ ops/model.py:1960: note:          @overload
+ ops/model.py:1960: note:          @overload
+ ops/model.py:1960: note:          def update(self, Iterable[tuple[str, str]], /) -> None

cibuildwheel (https://github.com/pypa/cibuildwheel)
+ cibuildwheel/projectfiles.py:73: error: Incompatible types in assignment (expression has type "str | bytes | int | float | complex | EllipsisType | None", variable has type "str | None")  [assignment]

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/options.py:1153:9: error: No overload variant of "update" of "MutableMapping" matches argument type "dict[str, UserBooleanOption | UserComboOption | UserFeatureOption | UserIntegerOption | UserStdOption | UserStringArrayOption | UserStringOption | UserUmaskOption]"  [call-overload]
+ mesonbuild/options.py:1153:9: note: Possible overload variants:
+ mesonbuild/options.py:1153:9: note:     def update(self, SupportsKeysAndGetItem[OptionKey, UserBooleanOption | UserComboOption | UserFeatureOption | UserIntegerOption | UserStdOption | UserStringArrayOption | UserStringOption | UserUmaskOption], /) -> None
+ mesonbuild/options.py:1153:9: note:     def update(self, Iterable[tuple[OptionKey, UserBooleanOption | UserComboOption | UserFeatureOption | UserIntegerOption | UserStdOption | UserStringArrayOption | UserStringOption | UserUmaskOption]], /) -> None

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.py:309: error: No overload variant of "update" of "MutableMapping" matches argument type "dict[str, V]"  [call-overload]
+ src/werkzeug/datastructures/mixins.py:309: note: Possible overload variants:
+ src/werkzeug/datastructures/mixins.py:309: note:     def update(self, SupportsKeysAndGetItem[K, V], /) -> None
+ src/werkzeug/datastructures/mixins.py:309: note:     def update(self, Iterable[tuple[K, V]], /) -> None
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "bytes")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "int")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "float")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "complex")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "None")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("str" and "ellipsis")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "str")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "int")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "float")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "complex")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "None")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("bytes" and "ellipsis")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("int" and "str")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("int" and "bytes")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("int" and "None")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("int" and "ellipsis")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("float" and "str")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("float" and "bytes")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("float" and "None")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("float" and "ellipsis")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("complex" and "str")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("complex" and "bytes")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("complex" and "None")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("complex" and "ellipsis")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported left operand type for + ("None")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("None" and "int")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("None" and "float")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("None" and "complex")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported left operand type for + ("ellipsis")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("ellipsis" and "int")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("ellipsis" and "float")  [operator]
+ src/werkzeug/routing/rules.py:779: error: Unsupported operand types for + ("ellipsis" and "complex")  [operator]
+ src/werkzeug/routing/rules.py:779: note: Both left and right operands are unions

aioredis (https://github.com/aio-libs/aioredis)
- aioredis/client.py:146: note:          def update(self, SupportsKeysAndGetItem[Any, Any], /, **kwargs: Any) -> None
+ aioredis/client.py:146: note:          def update(self, SupportsKeysAndGetItem[Any, Any], /) -> None
+ aioredis/client.py:146: note:          def update(self, SupportsKeysAndGetItem[str, Any], /, **kwargs: Any) -> None
+ aioredis/client.py:146: note:          @overload
+ aioredis/client.py:146: note:          def update(self, Iterable[tuple[Any, Any]], /) -> None
+ aioredis/client.py:146: note:          @overload
- aioredis/client.py:146: note:          def update(self, Iterable[tuple[Any, Any]], /, **kwargs: Any) -> None
+ aioredis/client.py:146: note:          def update(self, Iterable[tuple[str, Any]], /, **kwargs: Any) -> None

discord.py (https://github.com/Rapptz/discord.py): 1.06x faster (289.8s -> 272.2s in single noisy sample)
+ discord/client.py:733: note:     def update(self, SupportsKeysAndGetItem[str, int | None], /) -> None
+ discord/client.py:733: note:     def update(self, Iterable[tuple[str, int | None]], /) -> None
+ discord/client.py:759: note:     def update(self, SupportsKeysAndGetItem[str, int | None], /) -> None
+ discord/client.py:759: note:     def update(self, Iterable[tuple[str, int | None]], /) -> None
- ...:1010: note: "update" of "TypedDict" defined here
+ ...:1014: note: "update" of "TypedDict" defined here
- ...:1010: note: "update" of "TypedDict" defined here
+ ...:1014: note: "update" of "TypedDict" defined here

@cdce8p
Copy link
Collaborator

cdce8p commented Jun 1, 2025

Opened #19194 with an added type: ignore since I can't push directly to this branch here.

@cdce8p cdce8p closed this Jun 1, 2025
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.

5 participants