Skip to content

[name-defined] when PEP-696 type var uses another type var as default #20020

@sobolevn

Description

@sobolevn
class A[X, Y = X]: ... print(A.__parameters__) print(A.__parameters__[1].__default__)

This in runtime produces:

(X, Y) X

While mypy@1.18.1 produces on python 3.13:

ex.py:1: error: Name "X" is not defined [name-defined] 

which just the default configuration.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions