-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Do not crash in "too few arguments" error with anon argument #3313
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine as is but if you have a sec here are some style nits.
test-data/unit/check-functions.test
Outdated
@@ -2039,3 +2039,8 @@ l: List[int] = make_list() | |||
|
|||
bad = make_list() # E: Need type annotation for variable | |||
[builtins fixtures/list.pyi] | |||
|
|||
[case testAnonymousArgumentError] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this blank line.
mypy/messages.py
Outdated
@@ -575,7 +575,7 @@ def too_few_arguments(self, callee: CallableType, context: Context, | |||
msg = 'Missing positional argument' | |||
else: | |||
msg = 'Missing positional arguments' | |||
if callee.name and diff: | |||
if callee.name and [d for d in diff if d is not None]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just be if callee.name and any(diff):
... Or if that's too cryptic use any(d is not None for d in diff)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh. Should be all
, thanks for the collaborative catch.
... wow, who'd have thunk I'd get something so simple wrong so many times. |
It's the release pressure. Happens to me all the time. Also, this logic is pretty subtle. And thanks for fixing this under pressure! |
This should fix #3312