Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Missing positional arguments" error reports optional arguments #7527

Closed
ghost opened this issue Sep 18, 2019 · 3 comments · Fixed by #7547
Closed

"Missing positional arguments" error reports optional arguments #7527

ghost opened this issue Sep 18, 2019 · 3 comments · Fixed by #7547

Comments

@ghost
Copy link

ghost commented Sep 18, 2019

  • Are you reporting a bug, or opening a feature request?

bug

  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
def f(
    a: int,
    b: int = 1,
    c: int = 2,
    d: int = 3,
    e: int = 4):
    pass

f(b=4)
  • What is the actual behavior/output?

a.py:9: error: Missing positional arguments "a", "c", "d", "e" in call to "f"

  • What is the behavior/output you expect?

a.py:9: error: Missing positional argument "a" in call to "f"

It is only necessary to add a, so c, d, and e should not be mentioned in the error.

  • What are the versions of mypy and Python you are using?
    Do you see the same issue after installing mypy from Git master?
Python 3.7.4
mypy 0.730+dev.61cdc95699233a9c20622949fcafcc03f7e31196

Still see the issue with latest mypy.

  • What are the mypy flags you are using? (For example --strict-optional)

none

@ghost
Copy link
Author

ghost commented Sep 18, 2019

Related: #3963

@JukkaL
Copy link
Collaborator

JukkaL commented Sep 20, 2019

If somebody wants to create a PR, the relevant code is in mypy/messages.py (too_few_arguments()) and mypy/checkexpr (check_argument_count()).

@PattenR
Copy link
Contributor

PattenR commented Sep 21, 2019

Hey guys, PR here.

Looks like the list of remaining positional arguments printed was taken as all the missing arguments instead of just the missing positional arguments.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants