Closed
Description
Right now there's an uncovered branch in TypeVarTuple.__typing_prepare_subst__
:
And it looks like there's a bug in it, these two lines:
for param in enumerate(params[typevartuple_index + 1:]):
if isinstance(param, TypeVarTuple):
This if
's body will never be executed, because enumerate
always returns tuple[int, T]
, it is never TypeVarTuple
.
So, I think that we need to remove enumerate()
call here and add a test like:
>>> from typing import Generic, TypeVarTuple
>>> V = TypeVarTuple('V')
>>> T = TypeVarTuple('T')
>>> class My(Generic[*T]): pass
...
>>> My[*T, *V][*V]
TypeError: More than one TypeVarTuple parameter in __main__.My[*T, *V]
I will send a PR 😉