KEMBAR78
Fix unwrapping assignment expressions in match subject by cdce8p · Pull Request #19742 · python/mypy · GitHub
Skip to content

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Aug 26, 2025

The else_map from guard clauses can only be applied properly if the subject expression itself can be put on the binder. Unwrap assignment expressions so we don't need to fall back to a dummy name and loose the guard clause inference.

@cdce8p cdce8p added the topic-match-statement Python 3.10's match statement label Aug 26, 2025
@github-actions
Copy link
Contributor

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

@cdce8p cdce8p requested a review from ilevkivskyi August 27, 2025 00:00
@ilevkivskyi ilevkivskyi merged commit de1247d into python:master Aug 27, 2025
20 checks passed
@cdce8p cdce8p deleted the match-assign-expr branch August 27, 2025 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-match-statement Python 3.10's match statement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants