pyright
pyright copied to clipboard
false negative on passing Ps to (*Ps) -> Any
Describe the bug
a buggy program, iterating over Tuple[*Ps] and pass each element to Callable[[*Ps], Any] does not reported as type error by pyright.
To Reproduce
#!/usr/bin/env python3
# pyright: strict
from typing import Any, Callable, Tuple
from typing_extensions import TypeVarTuple, Unpack
Ps = TypeVarTuple("Ps")
def bad_apply(f: Callable[[Unpack[Ps]], Any], p: Tuple[Unpack[Ps]]):
for i in p:
f(i)
def f(n: int, s: str = ""):
print(f"n is {type(n)}")
bad_apply(f, (1, "foo"))
Found 1 source file
pyright 1.1.279
0 errors, 0 warnings, 0 informations
Expected behavior
pyright generates some errors against the code above
VS Code extension or command-line
command-line tool, version 1.1.279
This will be fixed in the next release.
This is addressed in pyright 1.1.280, which I just published. It will also be included in a future version of pylance.