-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Sync typeshed #15334
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
Sync typeshed #15334
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@877e06a
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: #13987 (comment) A manual cherry-pick of e437cdf.
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: pip (https://github.com/pypa/pip)
- src/pip/_internal/network/xmlrpc.py:36: error: Argument 3 of "request" is incompatible with supertype "Transport"; supertype defines the argument type as "bytes | bytearray | memoryview | array[Any] | mmap | _CData | PickleBuffer" [override]
+ src/pip/_internal/network/xmlrpc.py:36: error: Argument 3 of "request" is incompatible with supertype "Transport"; supertype defines the argument type as "SizedBuffer" [override]
isort (https://github.com/pycqa/isort)
- isort/api.py:196: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
+ isort/api.py:196: note: def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
- isort/api.py:196: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
+ isort/api.py:196: note: def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
- isort/api.py:196: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
+ isort/api.py:196: note: def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
- isort/api.py:196: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
+ isort/api.py:196: note: def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
- isort/api.py:223: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
+ isort/api.py:223: note: def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[0], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> CodeType
- isort/api.py:223: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
+ isort/api.py:223: note: def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, *, dont_inherit: bool = ..., optimize: int = ..., _feature_version: int = ...) -> CodeType
- isort/api.py:223: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
+ isort/api.py:223: note: def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: Literal[1024], dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> AST
- isort/api.py:223: note: def compile(source: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], Module, Expression, Interactive], filename: Union[str, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
+ isort/api.py:223: note: def compile(source: Union[str, Buffer, Module, Expression, Interactive], filename: Union[str, Buffer, _PathLike[Any]], mode: str, flags: int, dont_inherit: bool = ..., optimize: int = ..., *, _feature_version: int = ...) -> Any
operator (https://github.com/canonical/operator)
- ops/pebble.py:1343: error: Argument 1 of "write" is incompatible with supertype "BufferedIOBase"; supertype defines the argument type as "bytes | bytearray | memoryview | array[Any] | mmap | _CData | PickleBuffer" [override]
+ ops/pebble.py:1343: error: Argument 1 of "write" is incompatible with supertype "BufferedIOBase"; supertype defines the argument type as "Buffer" [override]
- ops/model.py:2616: note: def run(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: Literal[False] | None = ..., startupinfo: Any = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, capture_output: bool = ..., check: bool = ..., encoding: None = ..., errors: None = ..., input: bytes | bytearray | memoryview | array[Any] | mmap | _CData | PickleBuffer | None = ..., text: Literal[False] | None = ..., timeout: float | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> CompletedProcess[bytes]
+ ops/model.py:2616: note: def run(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: Literal[False] | None = ..., startupinfo: Any = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, capture_output: bool = ..., check: bool = ..., encoding: None = ..., errors: None = ..., input: Buffer | None = ..., text: Literal[False] | None = ..., timeout: float | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> CompletedProcess[bytes]
- ops/model.py:2616: note: def run(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, capture_output: bool = ..., check: bool = ..., encoding: str | None = ..., errors: str | None = ..., input: bytes | bytearray | memoryview | array[Any] | mmap | _CData | PickleBuffer | str | None = ..., text: bool | None = ..., timeout: float | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> CompletedProcess[Any]
+ ops/model.py:2616: note: def run(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, capture_output: bool = ..., check: bool = ..., encoding: str | None = ..., errors: str | None = ..., input: Buffer | str | None = ..., text: bool | None = ..., timeout: float | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> CompletedProcess[Any]
steam.py (https://github.com/Gobot1234/steam.py)
- steam/_const.py:114: error: Incompatible default for argument "unpacker" (default has type "Callable[[bytes | bytearray | memoryview | array[Any] | mmap | _CData | PickleBuffer, int], tuple[Any, ...]]", argument has type "Callable[[bytes], tuple[int]]") [assignment]
+ steam/_const.py:114: error: Incompatible default for argument "unpacker" (default has type "Callable[[Buffer, int], tuple[Any, ...]]", argument has type "Callable[[bytes], tuple[int]]") [assignment]
- steam/ext/csgo/state.py:33: error: Incompatible default for argument "_unpacker" (default has type "Callable[[bytes | bytearray | memoryview | array[Any] | mmap | _CData | PickleBuffer, int], tuple[Any, ...]]", argument has type "Callable[[bytes], tuple[float]]") [assignment]
+ steam/ext/csgo/state.py:33: error: Incompatible default for argument "_unpacker" (default has type "Callable[[Buffer, int], tuple[Any, ...]]", argument has type "Callable[[bytes], tuple[float]]") [assignment]
discord.py (https://github.com/Rapptz/discord.py)
- discord/app_commands/models.py:205: note: def __new__(cls, str | bytes | bytearray | memoryview | array[Any] | mmap | _CData | PickleBuffer | SupportsInt | SupportsIndex | SupportsTrunc = ..., /) -> int
+ discord/app_commands/models.py:205: note: def __new__(cls, str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc = ..., /) -> int
pydantic (https://github.com/samuelcolvin/pydantic)
- pydantic/_internal/_typing_extra.py:15: error: Module "typing_extensions" has no attribute "TypeAliasType" [attr-defined]
- pydantic/_internal/_core_utils.py:7: error: Module "typing_extensions" has no attribute "TypeAliasType" [attr-defined]
- pydantic/_internal/_generate_schema.py:21: error: Module "typing_extensions" has no attribute "TypeAliasType" [attr-defined]
|
1 task
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@877e06a
Note that you will need to close and re-open the PR in order to trigger CI.