KEMBAR78
Fix crash on redefined class variable annotated with `Final[<type>]` by AlexWaygood · Pull Request #12951 · python/mypy · GitHub
Skip to content

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jun 7, 2022

Description

Fixes #12950.

Mypy currently crashes on this snippet of code:

from typing import Final

class MyClass:
    a: None
    a: Final[int] = 1

This PR fixes that.

Test Plan

I added a test.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2022

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit c3e32e3 into python:master Jun 7, 2022
@AlexWaygood AlexWaygood deleted the final branch June 7, 2022 17:24
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.

mypy fails when redefining class variable with Final[Type] type annotation

2 participants