Repository navigation
conformance: remove questionable generic syntax test - #2368
Merged
Merged
Conversation
We noticed this test from a ty change that (correctly) disallows passing `Foo[T]` where `type[Foo[T]]` is expected: `Foo[T]` is a `GenericAlias`, not a type. But when I looked at the test, I noticed it doesn't really make sense to use a generic here at all. `__init_subclass__` is evaluated at the class level and can't possibly be generic. Probably TypeVars should be disallowed here for the same reason they're disallowed in ClassVars. But adding that to the spec or type checkers seems more trouble than it's worth; for now let's just remove the dubious test.
AlexWaygood
approved these changes
Oct 14, 2026
carljm
approved these changes
Oct 14, 2026
jorenham
approved these changes
Oct 14, 2026
AlexWaygood
pushed a commit
to astral-sh/ruff
that referenced
this pull request
Oct 15, 2026
We update the typing conformance suite from `835b70f` to `d06c5dd`. This includes [python/typing#2368](python/typing#2368), which removes the questionable generic `__init_subclass__` example that passed `Foo[T]` to a parameter annotated as `type[Foo[T]]`.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We noticed this test from a ty change that (correctly) disallows
passing
Foo[T]wheretype[Foo[T]]is expected:Foo[T]is aGenericAlias, not a type. But when I looked at the test, I noticedit doesn't really make sense to use a generic here at all.
__init_subclass__is evaluated at the class level and can't possibly be generic. Probably
TypeVars should be disallowed here for the same reason they're disallowed
in ClassVars. But adding that to the spec or type checkers seems more
trouble than it's worth; for now let's just remove the dubious test.