Skip to content

Do not crash in "too few arguments" error with anon argument#3313

Merged
gvanrossum merged 5 commits into
python:masterfrom
sixolet:anon-arg-error
May 3, 2017
Merged

Do not crash in "too few arguments" error with anon argument#3313
gvanrossum merged 5 commits into
python:masterfrom
sixolet:anon-arg-error

Conversation

@sixolet

@sixolet sixolet commented May 3, 2017

Copy link
Copy Markdown
Collaborator

This should fix #3312

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

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.

Comment thread test-data/unit/check-functions.test Outdated
[builtins fixtures/list.pyi]

[case testAnonymousArgumentError]

Copy link
Copy Markdown
Member

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.

Comment thread mypy/messages.py Outdated
else:
msg = 'Missing positional arguments'
if callee.name and diff:
if callee.name and [d for d in diff if d is not None]:

Copy link
Copy Markdown
Member

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).

Copy link
Copy Markdown
Collaborator Author

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.

@sixolet

sixolet commented May 3, 2017

Copy link
Copy Markdown
Collaborator Author

... wow, who'd have thunk I'd get something so simple wrong so many times.

@gvanrossum gvanrossum merged commit 09e7b12 into python:master May 3, 2017
@gvanrossum

Copy link
Copy Markdown
Member

... 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!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when a function with anonymous args is missing an argument

2 participants