False positive with splat and explicit kwarg
Open
Nobody has claimed this yet.
bug
topic-calls
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
Mypy reports multiple values for a kwarg if args are given via splat and the kwarg is explicitly set.
To Reproduce
def foo(x: int, y: int, z: str) -> None:
print(x, y, z)
args = [1, 2]
foo(*args, z="...")
Expected Behavior
Mypy should not report any problems.
Actual Behavior
mypysandbox.py:5: error: "foo" gets multiple values for keyword argument "z" [misc]
mypysandbox.py:5: error: Argument 1 to "foo" has incompatible type "*list[int]"; expected "str" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
$ mypy --version
mypy 1.19.1 (compiled: yes)
$ python --version
Python 3.12.12
Mypy config from pyproject.toml:
[tool.mypy]
strict = true
allow_redefinition = true
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal Python reproducer in the issue and compare mypy's handling of a splatted list followed by an explicit keyword argument. Use the strict configuration from pyproject.toml when checking the behavior; done means the example produces no diagnostics, including no duplicate-keyword or incompatible-type errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100