Skip to content

Narrow for frozendict membership check#21709

Merged
hauntsaninja merged 1 commit into
python:masterfrom
hauntsaninja:frozendict2
Jul 9, 2026
Merged

Narrow for frozendict membership check#21709
hauntsaninja merged 1 commit into
python:masterfrom
hauntsaninja:frozendict2

Conversation

@hauntsaninja

@hauntsaninja hauntsaninja commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator
def narrow(key: int | None, mapping: frozendict[int, str]) -> None:
    if key in mapping:
        reveal_type(key)  # N: Revealed type is "builtins.int"

Linking #21447

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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

@hauntsaninja hauntsaninja merged commit cbcb51a into python:master Jul 9, 2026
25 checks passed
@hauntsaninja hauntsaninja deleted the frozendict2 branch July 9, 2026 06:55
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.

1 participant