Skip to content

Make infer_condition_value recognize the whole truth table #18944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 5, 2025

Conversation

sterliakov
Copy link
Collaborator

Fixes #18901.

Side question: why don't we support boolean literals there (as in if True or sys.platform == "linux")? Is it an escape hatch to make mypy check some {platform,version}-dependent code on all {platform,version}s?

This comment has been minimized.

This comment has been minimized.

… any stmt - there are no error reports. Make MYPY_* vs ALWAYS_* consistent.

This comment has been minimized.

@sterliakov sterliakov marked this pull request as ready for review April 22, 2025 12:21

This comment has been minimized.

This comment has been minimized.

@sterliakov sterliakov requested a review from JukkaL May 29, 2025 12:33
Copy link
Contributor

github-actions bot commented Jun 4, 2025

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

pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_docs_extraction.py:104: error: Incompatible types in assignment (expression has type "list[str] | None", variable has type "list[str]")  [assignment]

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, looks good!

@JukkaL JukkaL merged commit 85d0e14 into python:master Jun 5, 2025
19 checks passed
@JukkaL
Copy link
Collaborator

JukkaL commented Jun 5, 2025

Side question: why don't we support boolean literals there (as in if True or sys.platform == "linux")? Is it an escape hatch to make mypy check some {platform,version}-dependent code on all {platform,version}s?

I'm not sure if there is any good reason for this. Maybe try changing this and see what mypy primer looks like?

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.

Unreachability depends on statement ordering
2 participants