Skip to content

Conversation

@github-actions
Copy link
Contributor

Sync typeshed

Source commit:
python/typeshed@2f3c3b7

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

mypybot and others added 6 commits December 15, 2025 00:08
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)
@github-actions

This comment has been minimized.

@hauntsaninja
Copy link
Collaborator

Primer is python/typeshed#15085

@github-actions
Copy link
Contributor Author

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

starlette (https://github.com/encode/starlette)
+ tests/test_datastructures.py:171: error: No overload variant of "get" of "Mapping" matches argument types "str", "None"  [call-overload]
+ tests/test_datastructures.py:171: note: Possible overload variants:
+ tests/test_datastructures.py:171: note:     def get(self, str, /) -> str | None
+ tests/test_datastructures.py:171: note:     def get(self, str, str, /) -> str
+ tests/test_datastructures.py:171: note:     def [_T] get(self, str, _T, /) -> str | _T
+ tests/test_datastructures.py:287: error: No overload variant of "get" of "Mapping" matches argument types "str", "None"  [call-overload]
+ tests/test_datastructures.py:287: note: Possible overload variants:
+ tests/test_datastructures.py:287: note:     def get(self, str, /) -> str | None
+ tests/test_datastructures.py:287: note:     def get(self, str, str, /) -> str
+ tests/test_datastructures.py:287: note:     def [_T] get(self, str, _T, /) -> str | _T
+ tests/test_datastructures.py:371: error: No overload variant of "get" of "Mapping" matches argument types "str", "None"  [call-overload]
+ tests/test_datastructures.py:371: note: Possible overload variants:
+ tests/test_datastructures.py:371: note:     def get(self, str, /) -> UploadFile | str | None
+ tests/test_datastructures.py:371: note:     def get(self, str, UploadFile | str, /) -> UploadFile | str
+ tests/test_datastructures.py:371: note:     def [_T] get(self, str, _T, /) -> UploadFile | str | _T
+ tests/test_datastructures.py:406: error: No overload variant of "get" of "Mapping" matches argument types "str", "None"  [call-overload]
+ tests/test_datastructures.py:406: note: Possible overload variants:
+ tests/test_datastructures.py:406: note:     def get(self, Any, /) -> Any | None
+ tests/test_datastructures.py:406: note:     def get(self, Any, Any, /) -> Any
+ tests/test_datastructures.py:406: note:     def [_T] get(self, Any, _T, /) -> Any | _T

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/cmdline.py:29: error: Return type "tuple[Action | None, str, str | None] | None" of "_parse_optional" incompatible with return type "list[tuple[Action | None, str, str | None, str | None]] | None" in supertype "argparse.ArgumentParser"  [override]
+ scrapy/cmdline.py:37: error: Incompatible return value type (got "list[tuple[Action | None, str, str | None, str | None]] | None", expected "tuple[Action | None, str, str | None] | None")  [return-value]

operator (https://github.com/canonical/operator)
- ops/model.py:1016: note:          def get(self, str, /, default: Binding) -> Binding
+ ops/model.py:1016: note:          def get(self, str, Binding, /) -> Binding
- ops/model.py:1016: note:          def [_T] get(self, str, /, default: _T) -> Binding | _T
+ ops/model.py:1016: note:          def [_T] get(self, str, _T, /) -> Binding | _T

steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/commands/utils.py:43: note:          def get(self, str, /, default: _VT) -> _VT
+ steam/ext/commands/utils.py:43: note:          def get(self, str, _VT, /) -> _VT
- steam/ext/commands/utils.py:43: note:          def [_T] get(self, str, /, default: _T) -> _VT | _T
+ steam/ext/commands/utils.py:43: note:          def [_T] get(self, str, _T, /) -> _VT | _T
- steam/ext/commands/utils.py:52: note:          def pop(self, str, /, default: _VT) -> _VT
+ steam/ext/commands/utils.py:52: note:          def pop(self, str, _VT, /) -> _VT
- steam/ext/commands/utils.py:52: note:          def [_T] pop(self, str, /, default: _T) -> _VT | _T
+ steam/ext/commands/utils.py:52: note:          def [_T] pop(self, str, _T, /) -> _VT | _T

discord.py (https://github.com/Rapptz/discord.py)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/typing.pyi:1041: note: "update" of "TypedDict" defined here
+ ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/typing.pyi:1046: note: "update" of "TypedDict" defined here

pyodide (https://github.com/pyodide/pyodide)
- pyodide-build/pyodide_build/xbuildenv_releases.py:220: note:     def get(self, str, /, default: str) -> str
+ pyodide-build/pyodide_build/xbuildenv_releases.py:220: note:     def get(self, str, str, /) -> str
- pyodide-build/pyodide_build/xbuildenv_releases.py:220: note:     def [_T] get(self, str, /, default: _T) -> str | _T
+ pyodide-build/pyodide_build/xbuildenv_releases.py:220: note:     def [_T] get(self, str, _T, /) -> str | _T

@hauntsaninja hauntsaninja merged commit e089abc into master Dec 15, 2025
23 checks passed
@hauntsaninja hauntsaninja deleted the mypybot/sync-typeshed branch December 15, 2025 01:26
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