Closed brentyi closed 2 weeks ago
Thanks for the issue. Yes, this is a bug. If you don't specify a type argument for a variadic type parameter, the value of the type argument should default to *tuple[Unknown, ...]
rather than *tuple[Unknown]
, as pyright is currently doing.
This will be fixed in the next release of pyright.
This is addressed in pyright 1.1.370
When working with variadic generics, I frequently run into length mismatch errors that seem to be (1) associated with bidirectional inference and (2) how some edge case handles
SomeClass[Unknown]
forSomeClass[*T]
.I've done my best to produce a minimal example (Python 3.12, pyright 1.1.369):
Specifically, I get an error on the last line about the length of the
args
argument:The reason this matters is that I frequently have things like
list[MyClass[Unknown]]
, which I then can't appendcreate(args=(1,2))
to.We can also reproduce this with a
Callable
signature:Thanks for reading!!