Open
Description
Bug Report
When using specific arguments after providing arguments with *args
, mypy will report an error.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=f8b653e4348ebc7a4006c2a126ed0d85
Expected Behavior
Mypy should succeed.
Actual Behavior
main.py:5: error: Too many arguments for "foo" [call-arg]
Found 1 error in 1 file (checked 1 source file)
Your Environment
See playground
Metadata
Metadata
Assignees
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
ichard26 commentedon Feb 16, 2023
This is similar to #9710, however, mypy is not entirely incorrect. This simple example would "type check" but blow up at runtime if
Tuple
was compatible withfoo
's signature :I suppose this goes the other way too.
bar()
is a valid way to callbar
but it would immediately blow up asfoo
would only get one argument.The error message should probably be tweaked to say
Potentially too few or many arguments for "foo"
or something similar.tierriminator commentedon Feb 16, 2023
The issue I have with this is that mypy won't complain if we just omit the specific argument or use it at the beginning.
Both
and
will type check successfully.
In both cases we would have the same problem of potentially incorrect number of arguments.
ichard26 commentedon Feb 19, 2023
Yea, I don't know what's up with that. I'd guess that is either an oversight or an explicit design choice to avoid technically-correct-but-low-value-relative-to-noise type errors.
ndevenish commentedon Jul 18, 2023
Almost equally simple reduced example (playground):