Skip to content

Conversation

@cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Jan 17, 2026

Source commit:
python/typeshed@b94c9e8

cdce8p and others added 7 commits January 17, 2026 12:27
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
Copy link
Contributor

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

pydantic (https://github.com/pydantic/pydantic)
- pydantic/v1/main.py:924: error: Set comprehension has incompatible type Set[int | str]; expected Set[str | None]  [misc]
- pydantic/v1/main.py:924: note: Left operand is of type "set[str] | dict_keys[str, Any]"

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:869: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/core/dtypes/cast.py:870: error: Unused "type: ignore" comment  [unused-ignore]

ibis (https://github.com/ibis-project/ibis)
- ibis/backends/sql/datatypes.py:1398: error: Unsupported operand types for - ("set[type[Never]]" and "set[type[SqlglotType]]")  [operator]
- ibis/expr/datatypes/tests/test_core.py:581: error: Unsupported operand types for - ("set[type[Never]]" and "set[AnnotableMeta]")  [operator]

trio (https://github.com/python-trio/trio)
+ src/trio/_util.py:301: error: Item "None" of "FrameType | None" has no attribute "f_globals"  [union-attr]
+ src/trio/_socket.py:354: error: Argument 2 to "socketpair" has incompatible type "socket | int"; expected "SocketKind | int"  [arg-type]
+ src/trio/_core/_tests/test_asyncgen.py:309: error: Item "None" of "FrameType | None" has no attribute "f_locals"  [union-attr]
+ src/trio/_core/_tests/test_asyncgen.py:313: error: Item "None" of "FrameType | None" has no attribute "f_locals"  [union-attr]

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/solr/data_provider.py: note: In member "preload_metadata" of class "DataProvider":
+ openlibrary/solr/data_provider.py:214: error: Argument 1 to "_get_lite_metadata" of "DataProvider" has incompatible type "tuple[tuple[str, ...], ...]"; expected "Sequence[str]"  [arg-type]
+ openlibrary/solr/data_provider.py:224: error: Argument 1 to "_get_lite_metadata_direct" of "DataProvider" has incompatible type "tuple[str, ...]"; expected "str"  [arg-type]

@cdce8p
Copy link
Collaborator Author

cdce8p commented Jan 17, 2026

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