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 as not planned
Closed as not planned
Copy link
Labels
Description
Bug report
Bug description:
After using Concatenate to recursively replace a ParamSpec of a TypeAliasType, another subscription with a type param is possible but the type param is not recognized.
In the last part the following code (C2T = C2[T] # <--- should create a generic), however it's parameters are empty and it cannot be subscripted further:
Consider the following code sample, also availiable on pyright playground
fromtypingimportTypeAliasType, Concatenate, ParamSpec, Any, TypeVarfromcollections.abcimportCallable# (**P) -> str type C[**P] =Callable[P, str] T=TypeVar("T") P2=ParamSpec("P2") # (int, **P2) -> strC2=C[Concatenate[int, P2]] # OK# (T) -> strC1T=C[T] # (str) -> strC1_str=C1T[str] # -------- # (int, T) -> strC2T=C2[T] # <--- does not create a genericprint(C2T.__parameters__) # <-- is empty# () # (int, str) -> strC2_str=C2T[str] # <-- cannot be subscripted# TypeError: C[(<class 'int'>, ~T)] is not a generic classCPython versions tested on:
3.13
Operating systems tested on:
Linux