FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

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

Repository navigation

gh-107944: Improve error message for getargs with bad keyword arguments - #114792

Merged
hauntsaninja merged 6 commits into
python:mainfrom
hauntsaninja:gh107944
Feb 8, 2024
Merged

hauntsaninja merged 6 commits into
python:mainfrom
hauntsaninja:gh107944

Conversation

hauntsaninja commented Jan 31, 2024 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Comment thread Python/getargs.c
}
else {
PyErr_Format(PyExc_TypeError,
"%.200s%s got an unexpected keyword argument '%S'",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

I still need to do the vgetargskeywords path...

Comment thread Lib/test/test_call.py
with self.check_suggestion_includes(suggestion):
func(bluch=None)

def test_unexpected_keyword_suggestion_via_getargs(self):

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the review! I added this test.

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

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Very good work @hauntsaninja! Thanks for working on this

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

hauntsaninja merged commit 17689e3 into python:main Feb 8, 2024
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
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
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


Back | FazBrowse Home | New Git URL