KEMBAR78
Fix dict assignment to a wider context containing an incompatible typeddict of the same shape by sterliakov · Pull Request #19592 · python/mypy · GitHub
Skip to content

Conversation

sterliakov
Copy link
Collaborator

@sterliakov sterliakov commented Aug 4, 2025

Fixes #19590.
Fixes #14991 (oops, I forgot I have already reported this...).

When a typeddict context does not cover all available options, proceed with checking as usual against the whole context if none of the items matches in full despite being structurally compatible.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2025

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

@sterliakov sterliakov marked this pull request as ready for review August 5, 2025 00:18
Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@hauntsaninja hauntsaninja merged commit 3387d6f into python:master Aug 5, 2025
20 checks passed
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.

Unexpected error when assigning dict literal to union containing TypedDict Upcasting causes incompatible types in assignment with TypedDict

2 participants