Skip to content

Disallow ClassVar in type aliases - #19263

Merged
hauntsaninja merged 1 commit into
python:masterfrom
brianschubert:conformance-classvar-type-alias
Jun 10, 2025
Merged

Disallow ClassVar in type aliases#19263
hauntsaninja merged 1 commit into
python:masterfrom
brianschubert:conformance-classvar-type-alias

Conversation

@brianschubert

Copy link
Copy Markdown
Collaborator

Reject the following case from the conformance tests:

bad12: TypeAlias = ClassVar[str]  # E: ClassVar not allowed here

@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 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.

Nice, thanks!

@hauntsaninja
hauntsaninja merged commit fe91422 into python:master Jun 10, 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.

2 participants