Skip to content

Sync typeshed #18467

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 5 commits into from
Jan 15, 2025
Merged

Sync typeshed #18467

merged 5 commits into from
Jan 15, 2025

Conversation

github-actions[bot]
Copy link
Contributor

Sync typeshed

Source commit:
python/typeshed@1012870

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

mypybot and others added 5 commits January 15, 2025 00:05
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)
@cdce8p cdce8p closed this Jan 15, 2025
@cdce8p cdce8p reopened this Jan 15, 2025
Copy link
Contributor Author

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

urllib3 (https://github.com/urllib3/urllib3)
+ test/contrib/test_socks.py:120: error: Incompatible return value type (got "list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]", expected "list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]")  [return-value]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/synchronous/auth.py:192: error: Argument 1 to "getnameinfo" has incompatible type "tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]"; expected "tuple[str, int] | tuple[str, int, int, int]"  [arg-type]
+ pymongo/asynchronous/auth.py:195: error: Argument 1 to "getnameinfo" has incompatible type "tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]"; expected "tuple[str, int] | tuple[str, int, int, int]"  [arg-type]

vision (https://github.com/pytorch/vision)
- torchvision/datasets/utils.py:215: note:     def open(name: str | bytes | PathLike[str] | PathLike[bytes] | None, mode: Literal['x', 'x:', 'a', 'a:', 'w', 'w:'], fileobj: _Fileobj | None = ..., bufsize: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., errors: str = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ...) -> TarFile
+ torchvision/datasets/utils.py:215: note:     def open(name: str | bytes | PathLike[str] | PathLike[bytes] | None, mode: Literal['x', 'x:', 'a', 'a:', 'w', 'w:', 'w:tar'], fileobj: _Fileobj | None = ..., bufsize: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., errors: str = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ...) -> TarFile
- torchvision/datasets/utils.py:215: note:     def open(name: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., *, mode: Literal['x', 'x:', 'a', 'a:', 'w', 'w:'], fileobj: _Fileobj | None = ..., bufsize: int = ..., format: int | None = ..., tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., errors: str = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ...) -> TarFile
+ torchvision/datasets/utils.py:215: note:     def open(name: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., *, mode: Literal['x', 'x:', 'a', 'a:', 'w', 'w:', 'w:tar'], fileobj: _Fileobj | None = ..., bufsize: int = ..., format: int | None = ..., tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., errors: str = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ...) -> TarFile

trio (https://github.com/python-trio/trio)
+ src/trio/_socket.py:215: error: Incompatible return value type (got "list[tuple[AddressFamily, SocketKind, int, str, Union[tuple[str, int], tuple[str, int, int, int], tuple[int, bytes]]]]", expected "list[tuple[AddressFamily, SocketKind, int, str, Union[tuple[str, int], tuple[str, int, int, int]]]]")  [return-value]
+ src/trio/_socket.py:244: error: Argument 1 to "to_thread_run_sync" has incompatible type "Callable[[Union[bytes, str, None], Union[bytes, str, int, None], int, int, int, int], list[tuple[AddressFamily, SocketKind, int, str, Union[tuple[str, int], tuple[str, int, int, int], tuple[int, bytes]]]]]"; expected "Callable[..., list[tuple[AddressFamily, SocketKind, int, str, Union[tuple[str, int], tuple[str, int, int, int]]]]]"  [arg-type]
+ src/trio/_tests/test_socket.py:130: error: Argument 1 to "MonkeypatchedGAI" has incompatible type "Callable[[Union[bytes, str, None], Union[bytes, str, int, None], int, int, int, int], list[tuple[AddressFamily, SocketKind, int, str, Union[tuple[str, int], tuple[str, int, int, int], tuple[int, bytes]]]]]"; expected "Callable[[Union[str, bytes, None], Union[str, bytes, int, None], int, int, int, int], list[tuple[AddressFamily, SocketKind, int, str, Union[tuple[str, int], tuple[str, int, int, int]]]]]"  [arg-type]

anyio (https://github.com/agronholm/anyio)
+ src/anyio/to_interpreter.py:75: error: Unused "type: ignore" comment  [unused-ignore]
+ src/anyio/to_interpreter.py:107: error: Unused "type: ignore" comment  [unused-ignore]
+ src/anyio/to_interpreter.py:111: error: Unused "type: ignore[arg-type, func-returns-value]" comment  [unused-ignore]

@cdce8p
Copy link
Collaborator

cdce8p commented Jan 15, 2025

Mypy primer hits

@hauntsaninja hauntsaninja merged commit 8859d51 into master Jan 15, 2025
18 checks passed
@hauntsaninja hauntsaninja deleted the mypybot/sync-typeshed branch January 15, 2025 19:53
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 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.

3 participants