Narrow for type expr comparisons to type exprs#20639
Merged
JukkaL merged 5 commits intopython:masterfrom Jan 23, 2026
Merged
Conversation
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: pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/arrays/base.py:1558: error: Redundant cast to "ExtensionArray" [redundant-cast]
+ pandas/core/indexes/datetimelike.py:279: error: Unused "type: ignore" comment [unused-ignore]
ibis (https://github.com/ibis-project/ibis)
- ibis/common/patterns.py:658: error: "Pattern" has no attribute "type" [attr-defined]
- ibis/common/patterns.py:934: error: "Pattern" has no attribute "patterns" [attr-defined]
rotki (https://github.com/rotki/rotki)
+ rotkehlchen/history/events/structures/base.py:209: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:210: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:211: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:212: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:213: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:214: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:215: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:216: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:217: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:218: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:219: error: Unused "type: ignore" comment [unused-ignore]
+ rotkehlchen/history/events/structures/base.py:220: error: Unused "type: ignore" comment [unused-ignore]
pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/misc.py:551: error: Redundant cast to "HiddenText" [redundant-cast]
|
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.
I refactored the logic for type(x) narrowing in #20634 , but left this piece out since it has material semantic impact
Fixes #11952
Fixes #20275