Open
Description
Bug Report
I believe the following code should be fine, however mypy rejects the case where we're unpacking into the variable which was expanded:
foo: tuple[int, ...] = ()
# Ok
bar, *quox = foo
# Incompatible types in assignment (expression has type "List[int]", variable has type "Tuple[int, ...]") [assignment]
bar, *foo = foo
There are a number of similar issues reported, the closest being #9706, however I believe this is distinct as it reproduces when the generic type is int
(though my original code was using str
). This suggests a different root cause.
Your Environment
- Mypy version used: 1.0.1
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.10