← 返回首页
Add conformance tests for Final dataclass fields by carljm · Pull Request #1741 · python/typing · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

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

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Add conformance tests for Final dataclass fields#1741

Merged
JelleZijlstra merged 2 commits into
python:mainfrom
carljm:dcfinaltests
May 20, 2024
Merged

Add conformance tests for Final dataclass fields#1741
JelleZijlstra merged 2 commits into
python:mainfrom
carljm:dcfinaltests

Conversation

carljm commented May 20, 2024
edited
Loading

Copy link
Copy Markdown
Member

Add conformance tests for the spec changes merged in #1669

None of the tested type checkers support nesting Final within ClassVar in dataclasses yet, so they all fail the automated conformance check. Mypy also requires a Final assignment in a dataclass body to be "initialized" (thus effectively requiring final dataclass fields to have a default). But all support the core behavior of defining a final dataclass field, so I marked them all as Partial.

erictraut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Looks good. One minor comment.

Comment thread conformance/results/mypy/dataclasses_final.toml Outdated Show resolved Hide resolved
JelleZijlstra merged commit 2d2e8ee into python:main May 20, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants

Footer

© 2026 GitHub, Inc.