GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-107944: Improve error message for function calls with bad keyword arguments by pablogsal · Pull Request #107969 · python/cpython

Conversation

@pablogsal

@pablogsal pablogsal commented Aug 15, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Improve error message for function calls with bad keyword arguments #107944

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pablogsal
pablogsal requested a review from markshannon as a code owner August 15, 2023 10:10
@bedevere-bot bedevere-bot mentioned this pull request Aug 14, 2023
Improve error message for function calls with bad keyword arguments #107944
Closed
@bedevere-bot bedevere-bot added the awaiting core review label Aug 15, 2023
lysnikolaou
lysnikolaou reviewed Aug 15, 2023
View reviewed changes
Comment thread Python/ceval.c
Py_DECREF(suggestion_keyword);
} else {
_PyErr_Format(tstate, PyExc_TypeError,
"%U() got an unexpected keyword argument '%S'",

@lysnikolaou lysnikolaou Aug 15, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Wouldn't it be a better UX if we included a list with all the possible keywords here? We could special-case it for cases where the list is smaller than X, in order to keep the output to a reasonable size.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@pablogsal pablogsal Aug 15, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think is better, but on the other hand, it would be a bunch of extra code (joining the list with commas + handling errors) so not sure if is worth the complexity. @rhettinger what do you think? (Note we are referring to the fallback message when we could not find the suggestion either because of errors or because there is nothing close).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lysnikolaou reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@rhettinger rhettinger Aug 17, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

what do you think?

I think what you have now will suffice — only offer a suggestion when a plausible candidate can be found; otherwise, just note that the keyword argument doesn't match.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pablogsal
pablogsal force-pushed the gh-107944 branch from 34e4362 to 586f233 Compare August 15, 2023 10:17
@pablogsal
pablogsal requested a review from rhettinger August 15, 2023 10:22
@pablogsal
pablogsal force-pushed the gh-107944 branch 2 times, most recently from 0c61952 to a1e2c35 Compare August 15, 2023 10:55
@pablogsal
pythongh-107944: Improve error message for function calls with bad ke…
efcd204
…yword arguments

Signed-off-by: Pablo Galindo <[email protected]>
@pablogsal
pablogsal force-pushed the gh-107944 branch from a1e2c35 to efcd204 Compare August 15, 2023 11:00
@pablogsal

pablogsal commented Aug 16, 2023

Copy link
Copy Markdown
Member Author

@lysnikolaou apart from the suggestion is everything else ok with you? (In that case, could you approve the PR?)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lysnikolaou
lysnikolaou approved these changes Aug 16, 2023
View reviewed changes

@lysnikolaou lysnikolaou left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good!!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Aug 16, 2023
@pablogsal
pablogsal merged commit 75b3db8 into python:main Aug 17, 2023
@pablogsal
pablogsal deleted the gh-107944 branch August 17, 2023 18:39
@bedevere-bot bedevere-bot removed the awaiting merge label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lysnikolaou lysnikolaou lysnikolaou approved these changes
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@rhettinger rhettinger Awaiting requested review from rhettinger

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@pablogsal @rhettinger @lysnikolaou @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.