Skip to content

Fix narrowing with final type objects#20743

Open
hauntsaninja wants to merge 2 commits intopython:masterfrom
hauntsaninja:narrow85
Open

Fix narrowing with final type objects#20743
hauntsaninja wants to merge 2 commits intopython:masterfrom
hauntsaninja:narrow85

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Feb 5, 2026


if isinstance(typ, UnionType):
type_ranges = [self.get_type_range_of_type(item) for item in typ.items]
is_upper_bound = any(t.is_upper_bound for t in type_ranges if t is not None)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

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

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