Skip to content

Process overloads as a whole in two-phase type-checking - #22231

Merged
ilevkivskyi merged 1 commit into
python:masterfrom
ilevkivskyi:fix-overload-two-phases
Oct 20, 2026
Merged

ilevkivskyi merged 1 commit into
python:masterfrom
ilevkivskyi:fix-overload-two-phases

Conversation

@ilevkivskyi

Copy link
Copy Markdown
Member

Fixes #22229

This fixes a regression that can (often) cause false negatives in settable properties.

The problem is that we currently may have some part of an overloaded function to be scheduled for processing as part of interface, and other parts to be processed as parts of implementation. This is especially problematic for properties (which are internally stored as overloads). I propose to always keep overloads as a whole. It may be marginally slower in parallel mode, but much simpler to reason about.

cc @JukkaL

@github-actions

Copy link
Copy Markdown
Contributor

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

pandera (https://github.com/pandera-dev/pandera)
- pandera/api/pandas/array.py:38: error: Unused "type: ignore" comment  [unused-ignore]

@ilevkivskyi

Copy link
Copy Markdown
Member Author

The new error in the primer is correct, exactly the kind of false negative this PR fixes.

@ilevkivskyi
ilevkivskyi merged commit 45992fc into python:master Oct 20, 2026
25 checks passed
@ilevkivskyi
ilevkivskyi deleted the fix-overload-two-phases branch October 20, 2026 12:09
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.

[2.4 regression] Property getter body is not type-checked when the setter assigns to self

2 participants