Sync typeshed - #21799
Open
cdce8p wants to merge 13 commits into
Open
Conversation
Source commit: python/typeshed@7ee1807
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.
This comment has been minimized.
This comment has been minimized.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web.py:554:24: error: Name "module" may be undefined [possibly-undefined]
+ aiohttp/web.py:554:24: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-possibly-undefined for more info
+ aiohttp/web.py:572:11: error: Name "func" may be undefined [possibly-undefined]
- aiohttp/worker.py:253:9: error: function asyncio.events.set_event_loop_policy is deprecated: Deprecated since Python 3.14; will be removed in Python 3.16. [deprecated]
+ aiohttp/worker.py:253:9: error: function asyncio.events.set_event_loop_policy is deprecated: Deprecated; will be removed in Python 3.16. [deprecated]
mypy (https://github.com/python/mypy)
+ mypy/main.py:479: error: Implicit return in function which does not return [misc]
comtypes (https://github.com/enthought/comtypes)
- comtypes/server/register.py:226: error: Incompatible types in assignment (expression has type "Iterator[tuple[int, str]]", variable has type "list[tuple[int, str]]") [assignment]
+ comtypes/server/register.py:226: error: Incompatible types in assignment (expression has type "reversed[tuple[int, str]]", variable has type "list[tuple[int, str]]") [assignment]
pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/commands/p2p.py: note: In function "address_range_explicit":
+ pwndbg/commands/p2p.py:29: error: Missing return statement [return]
+ pwndbg/commands/p2p.py: note: In function "address_range":
+ pwndbg/commands/p2p.py:41: error: Missing return statement [return]
discord.py (https://github.com/Rapptz/discord.py)
- discord/abc.py:1815: error: Incompatible types in assignment (expression has type "Iterator[MessagePin]", variable has type "list[MessagePin]") [assignment]
+ discord/abc.py:1815: error: Incompatible types in assignment (expression has type "reversed[MessagePin]", variable has type "list[MessagePin]") [assignment]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/monkeypatch.py:417: error: Unused "type: ignore" comment [unused-ignore]
+ src/_pytest/monkeypatch.py:422: error: Unused "type: ignore" comment [unused-ignore]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/utils.py:570: error: Returning Any from function declared to return "Iterator[Any]" [no-any-return]
materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/cli/ci_failures.py:134: error: Argument "token" to "fetch_failures" has incompatible type "str | None"; expected "str" [arg-type]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/cmd/build.py: note: In function "_parse_logging":
+ sphinx/cmd/build.py:358:41: error: Argument 2 to "TeeStripANSI" has incompatible type "TextIOWrapper[_WrappedBuffer] | None"; expected "SupportsWrite" [arg-type]
+ sphinx/cmd/build.py:358:41: note: Error code "arg-type" not covered by "type: ignore[assignment]" comment
+ sphinx/cmd/build.py: note: At top level:
|
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
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.
Source commit:
python/typeshed@7ee1807