gh-107944: Improve error message for getargs with bad keyword arguments by hauntsaninja · Pull Request #114792 · python/cpython
| } | ||
| else { | ||
| PyErr_Format(PyExc_TypeError, | ||
| "%.200s%s got an unexpected keyword argument '%S'", |
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
| with self.check_suggestion_includes(suggestion): | ||
| func(bluch=None) | ||
|
|
||
| def test_unexpected_keyword_suggestion_via_getargs(self): |
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
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.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters