Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Jan 23, 2026

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

@github-actions

This comment has been minimized.

@hauntsaninja hauntsaninja marked this pull request as ready for review January 23, 2026 04:37
@github-actions
Copy link
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]

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@JukkaL JukkaL merged commit 21d6773 into python:master Jan 23, 2026
23 checks passed
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.

Using type(other) is type(self) only works when revealing types type(var) is type(other) not considered enough

2 participants