KEMBAR78
Fix "not callable" issue for `@dataclass(frozen=True)` with `Final` attr by sobolevn · Pull Request #18572 · python/mypy · GitHub
Skip to content

Conversation

sobolevn
Copy link
Member

Closes #18567

We should allow inferenced a: Final = 1

@github-actions

This comment has been minimized.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Hmm what about changing _freeze in mypy.plugins.dataclasses to skip final attributes? Does it turn final attributes into properties? If yes, this sounds wrong to me.

Can you also test what happens if you access a final attribute via the type object, e.g. My.a?

@sobolevn
Copy link
Member Author

sobolevn commented Feb 3, 2025

Does it turn final attributes into properties? If yes, this sounds wrong to me.

Yes, it does. I will check what can be done there!

@sobolevn
Copy link
Member Author

sobolevn commented Feb 5, 2025

@JukkaL you were right, frozen plugin fix is better. Thank you!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2025

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

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good.

@JukkaL JukkaL merged commit ac921ae into master Feb 5, 2025
18 checks passed
@JukkaL JukkaL deleted the issue-18567 branch February 5, 2025 13:56
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
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.

dataclass(frozen=True) not working with default Final qualifier

2 participants