Skip to content

Sync typeshed#21507

Open
cdce8p wants to merge 14 commits into
python:masterfrom
cdce8p:sync-typeshed
Open

Sync typeshed#21507
cdce8p wants to merge 14 commits into
python:masterfrom
cdce8p:sync-typeshed

Conversation

@cdce8p
Copy link
Copy Markdown
Collaborator

@cdce8p cdce8p commented May 18, 2026

Source commit:
python/typeshed@3402466

cdce8p and others added 12 commits May 18, 2026 13:29
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)
The plugin provides superior type checking:
python#13987 (comment)
A manual cherry-pick of e437cdf.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

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

psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/_tstrings.py:43: error: Missing type arguments for generic type "Interpolation"  [type-arg]
+ psycopg/psycopg/_tstrings.py:97: error: Missing type arguments for generic type "Interpolation"  [type-arg]
+ psycopg/psycopg/_tstrings.py:110: error: Missing type arguments for generic type "Interpolation"  [type-arg]
+ psycopg/psycopg/_tstrings.py:123: error: Missing type arguments for generic type "Interpolation"  [type-arg]

spark (https://github.com/apache/spark)
+ python/pyspark/daemon.py:193: error: Value of type variable "_R" of "select" cannot be "object"  [type-var]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/cli/shell.py:76: note:     def [AnyStr: (str, bytes)] Popen(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[[], object] | 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 | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: Literal[True], encoding: str | None = ..., errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
+ src/prefect/cli/shell.py:76: note:     def [AnyStr: (str, bytes)] Popen(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[[], object] | 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[True] | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: Literal[True], encoding: str | None = ..., errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]

operator (https://github.com/canonical/operator)
+ ops/pebble.py:1902: error: Value of type variable "_R" of "select" cannot be "object"  [type-var]

zope.interface (https://github.com/zopefoundation/zope.interface)
- src/zope/interface/common/tests/test_io.py:36: error: Argument 1 to "BufferedWriter" has incompatible type "StringIO"; expected "RawIOBase"  [arg-type]
+ src/zope/interface/common/tests/test_io.py:36: error: Value of type variable "_BufferedWriterStreamT" of "BufferedWriter" cannot be "StringIO"  [type-var]
- src/zope/interface/common/tests/test_io.py:41: error: Argument 2 to "BufferedRWPair" has incompatible type "BytesIO"; expected "RawIOBase"  [arg-type]

pylint (https://github.com/pycqa/pylint)
+ pylint/testutils/lint_module_test.py:319: error: Name "_csv._writer" is not defined  [name-defined]

dulwich (https://github.com/dulwich/dulwich)
+ dulwich/filters.py:190: error: Returning Any from function declared to return "bytes"  [no-any-return]

pyodide (https://github.com/pyodide/pyodide)
+ src/py/pyodide/webloop.py:1060: error: Unused "type: ignore" comment  [unused-ignore]

pytest (https://github.com/pytest-dev/pytest)
+ testing/freeze/tox_run.py:16: error: function os.system is deprecated: Soft deprecated. Use the subprocess module instead.  [deprecated]

ibis (https://github.com/ibis-project/ibis)
- ibis/expr/visualize.py:183: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "_TemporaryFileWrapper[bytes]")  [assignment]
+ ibis/expr/visualize.py:183: error: Incompatible types in assignment (expression has type "BufferedWriter[_BufferedWriterStream]", variable has type "_TemporaryFileWrapper[bytes]")  [assignment]

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