-
-
Notifications
You must be signed in to change notification settings - Fork 34k
Open
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
With PEP 696 + PEP 749, the following works just fine:
class Scalar[CompatT, TruthT = BoolScalar]: ...
class BoolScalar(Scalar): ...
class IntScalar(Scalar[int]): ... # OK ✅️However, if we switch around the order of definition, the code breaks:
class Scalar[CompatT, TruthT = BoolScalar]: ...
class IntScalar(Scalar[int]): ... # ❌️ NameError: name 'BoolScalar' is not defined
class BoolScalar(Scalar): ...I guess since the default gets evaluated here. Not sure whether this is a bug or feature request, but it would be nice if the evaluation of the default could be deferred in is case as well.
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error