Admit that Final variables are never redefined by sterliakov · Pull Request #19083 · python/mypy

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@sterliakov

Copy link Copy Markdown

Collaborator

Fixes #19080. There is no point applying our heuristics if the variable is declared Final - it is not reassigned anywhere.

@github-actions

This comment has been minimized.

Copy link Copy Markdown

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.

Nice, thank you!

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

@github-actions

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 0b65f21 into python:master

May 13, 2025

18 checks passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hauntsaninja hauntsaninja hauntsaninja approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

mypy doesn't narrow Final objects in nested contexts

2 participants

@sterliakov @hauntsaninja