Skip to content

Handle reachability consistently in two-phase checking#21322

Merged
ilevkivskyi merged 1 commit intopython:masterfrom
ilevkivskyi:unreachable-two-phase
Apr 25, 2026
Merged

Handle reachability consistently in two-phase checking#21322
ilevkivskyi merged 1 commit intopython:masterfrom
ilevkivskyi:unreachable-two-phase

Conversation

@ilevkivskyi
Copy link
Copy Markdown
Member

We have this (somewhat questionable) behaviour of not checking unreachable code. Surprisingly many repos rely on this. Thus we should preserve this behaviour in two-phase checking, which means skip top-level definitions that were found unreachable.

I tried few approaches, and using line numbers seems to be the simplest one.
cc @JukkaL

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@ilevkivskyi ilevkivskyi merged commit b6ec270 into python:master Apr 25, 2026
24 checks passed
@ilevkivskyi ilevkivskyi deleted the unreachable-two-phase branch April 25, 2026 13: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.

2 participants