-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Sync typeshed #19189
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
Closed
Closed
Sync typeshed #19189
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source commit: python/typeshed@5a3c495
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)
… checking: #13987 (comment) A manual cherry-pick of e437cdf.
760f5d1
to
99dcf32
Compare
@hauntsaninja did you forget to reopen? |
My intention was to re-open yes, not sure what happened between my brain my fingers and github |
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
|
Opened #19194 with an added |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sync typeshed
Source commit:
python/typeshed@5a3c495
Note that you will need to close and re-open the PR in order to trigger CI.