Skip to content

[PEP 695] Generate error if new-style type alias used as base class#17789

Merged
JukkaL merged 1 commit into
masterfrom
alias-base-class
Sep 20, 2024
Merged

[PEP 695] Generate error if new-style type alias used as base class#17789
JukkaL merged 1 commit into
masterfrom
alias-base-class

Conversation

@JukkaL

@JukkaL JukkaL commented Sep 19, 2024

Copy link
Copy Markdown
Collaborator

It doesn't work at runtime.

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

@JukkaL
JukkaL merged commit 18fee78 into master Sep 20, 2024
@JukkaL
JukkaL deleted the alias-base-class branch September 20, 2024 11:49
@spt29

spt29 commented Mar 18, 2025

Copy link
Copy Markdown

Just out of curiosity: Why is this check necessary? I just came across it when trying to update old TypeAlias uses to the new type statement. With this restriction, the latter is not really a replacement for the former, and I can't immediately see a semantic reason for disallowing it, and I couldn't find something in the PEP about this, either.

(Related issue: The new type aliases are not callable, but the old ones were. This is useful when e.g. aliasing a NewType. So again, the new type aliases do not seem to be a full replacement for the old ones.)

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