-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
Description
Bug Report
Mypy ignores types in a explicitly checked tuple.
To Reproduce
- Create a file containing:
def func(a: str, b: int) -> None:
pass
t: tuple[str | None, int | None] = ('a', None)
if not all(t):
raise ValueError
func(*t)
- Run mypy.
Expected Behavior
No errors.
Actual Behavior
mypy_tuple.py:8: error: Argument 1 to "func" has incompatible type "*Tuple[Optional[str], Optional[int]]"; expected "str"
mypy_tuple.py:8: error: Argument 1 to "func" has incompatible type "*Tuple[Optional[str], Optional[int]]"; expected "int"
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 0.961
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: 3.10
- Operating system and version: Arch Linux
DanielNoord, macintacos, JavanW-W and DanielArndt