KEMBAR78
Make infer_condition_value recognize the whole truth table by sterliakov · Pull Request #18944 · python/mypy · GitHub
Skip to content

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?

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

@github-actions

This comment has been minimized.

@sterliakov sterliakov requested a review from JukkaL May 29, 2025 12:33
@github-actions
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