Skip to content

Conversation

@wyattscarpenter
Copy link
Contributor

@wyattscarpenter wyattscarpenter commented Jan 11, 2026

There is a special case about unreachability, return NotImplemented, which we did not until now mention, which we hereby now mention in the documentation of --warn-unreachable.

I also add a test to test this claimed behavior thoroughly. The current test tests its desired behavior, in a class, but the actual behavior of mypy is much broader than that, and applies all the time, it seems.

Fixes #20462. That issue is not correct anymore, as it was obsoleted by #20488. However, during its discussion @sterliakov brought up this NotImplemented edge case as something that should be documented. I think the documentation after this PR will be satisfactory by everyone's standards.

Similarly, this PR closes #20558.

Theoretically, there could be further special cases of unreachability of which I am not aware, but these can be noted by later PRs if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation: --warn-unreachable should clarify special handling of pass statements

2 participants