KEMBAR78
gh-107944: Improve error message for getargs with bad keyword arguments by hauntsaninja · Pull Request #114792 · python/cpython · GitHub
Skip to content

Conversation

@hauntsaninja
Copy link
Contributor

@hauntsaninja hauntsaninja commented Jan 31, 2024

}
else {
PyErr_Format(PyExc_TypeError,
"%.200s%s got an unexpected keyword argument '%S'",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this error message match the one in ceval.c

@hauntsaninja
Copy link
Contributor Author

I still need to do the vgetargskeywords path...

with self.check_suggestion_includes(suggestion):
func(bluch=None)

def test_unexpected_keyword_suggestion_via_getargs(self):
Copy link
Member

Choose a reason for hiding this comment

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

Do you mind adding a explicit test for when the suggestion fails (the 'else' case in the conditional here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! I added this test.

I also made a similar edit in the vgetargskeywords code path and added tests.

Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

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

Very good work @hauntsaninja! Thanks for working on this

This looks great, I left some nit but please feel free to ignore

@hauntsaninja hauntsaninja merged commit 17689e3 into python:main Feb 8, 2024
@hauntsaninja hauntsaninja deleted the gh107944 branch February 8, 2024 09:04
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
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.

2 participants