Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
In the code below, all of the prints should be equivalent:
fromtypingimportGeneric,Tuple,TypeVarTuple,UnpackTs=TypeVarTuple("Ts")classOld(Generic[*Ts]): ...classNew[*Ts]: ...PartOld=Old[int,*Ts]print(PartOld[str])print(PartOld[*tuple[str]])print(PartOld[*Tuple[str]])print(PartOld[Unpack[tuple[str]]])# Old[int, typing.Unpack[tuple[str]]]print(PartOld[Unpack[Tuple[str]]])PartNew=New[int,*Ts]print(PartNew[str])print(PartNew[*tuple[str]])print(PartNew[*Tuple[str]])print(PartNew[Unpack[tuple[str]]])# New[int, typing.Unpack[tuple[str]]]print(PartNew[Unpack[Tuple[str]]])
However, theUnpack[tuple[]] variants print something different. This is because the implementation ofUnpack doesn't deal correctly with builtin aliases. I'll send a PR.
CPython versions tested on:
3.12, CPython main branch
Operating systems tested on:
macOS