Skip to content

Commit

Permalink
stubtest: hint when args in stub need to be keyword-only (python#16210)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored Oct 1, 2023
1 parent 99ba048 commit bcd4ff2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,10 @@ def _verify_signature(
# If the variable is in runtime.kwonly, it's just mislabelled as not a
# keyword-only argument
if stub_arg.variable.name not in runtime.kwonly:
yield f'runtime does not have argument "{stub_arg.variable.name}"'
msg = f'runtime does not have argument "{stub_arg.variable.name}"'
if runtime.varkw is not None:
msg += ". Maybe you forgot to make it keyword-only in the stub?"
yield msg
else:
yield f'stub argument "{stub_arg.variable.name}" is not keyword-only'
if stub.varpos is not None:
Expand Down

0 comments on commit bcd4ff2

Please sign in to comment.