Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

to functions implemented in C that don't support this.

to functions implemented in C that don't support this.
@serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Jun 1, 2017
@serhiy-storchaka serhiy-storchaka requested a review from vstinner June 1, 2017 07:38
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I also like included cleanup changes ;-)

On the issue, I requested unit tests. But I also proposed to change the error message, so we write tests later, when we agree on what should be done.


def test_varargs0_kw(self):
self.assertRaises(TypeError, {}.__contains__, x=2)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may keep this test for other Python implementations. (This test doesn't check the error message.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate of the following test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok, you are right.

except TypeError as err:
# we expect type errors because of wrong argument count
self.assertNotIn("does not take keyword arguments", err.args[0])
print(repr(err))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove print()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Objects/call.c Outdated
break;

case METH_VARARGS:
if (!(flags & METH_KEYWORDS) && nkwargs) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "!(flags & METH_KEYWORDS)" still needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed. Removed.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@serhiy-storchaka serhiy-storchaka merged commit 5eb788b into python:master Jun 6, 2017
@serhiy-storchaka serhiy-storchaka deleted the call-no-keyword-args branch June 6, 2017 15:45
@serhiy-storchaka
Copy link
Member Author

Thank you for your review @Haypo.

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

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants