Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Consider this code:
classC: T="class" type Alias3[T] = (Tfor_in (1,)) type Alias5[T] = [Tfor_in (1,)] print(list(C.Alias3.__value__)) print(C.Alias5.__value__)On current main it produces:
[T] ['class'] So if you use a genexp, you get the T type parameter, but if you use a listcomp, you get the class variable. I think the genexp behavior is right; the comprehension should never see the class scope.
Found this while looking into #109118. Filing this separately as the symptom is different, but I suspect we'll have to solve both simultaneously. cc @carljm for PEP 709.
carljm
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error