Skip to content

gh-115077: Make some Argument Clinic error messages more helpful - #115078

Closed
erlend-aasland wants to merge 11 commits into
python:mainfrom
erlend-aasland:clinic/better-error-messages
Closed

gh-115077: Make some Argument Clinic error messages more helpful#115078
erlend-aasland wants to merge 11 commits into
python:mainfrom
erlend-aasland:clinic/better-error-messages

Conversation

@erlend-aasland

@erlend-aaslanderlend-aasland commented Feb 6, 2024

Copy link
Copy Markdown
Contributor

Comment threadTools/clinic/clinic.py Outdated
if len(args) > 2:
fail("Up to 2 critical section variables are supported")
fail("Only 2 critical section variables are supported; "
f"{len(args)} was given")

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.

Suggested change
f"{len(args)}was given")
f"{len(args)}were given")

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Perhaps also print them out?

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@erlend-aasland

Copy link
Copy Markdown
ContributorAuthor

@sobolevn, feel free to contribute to this branch/PR.

Comment threadTools/clinic/clinic.py Outdated
Comment on lines +838 to +839
fail("Cannot specify multiple varargs; "
f"'*{parameters[vararg].name}' was already provided as parameter {vararg+1}")

@serhiy-storchakaserhiy-storchakaFeb 6, 2024

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.

You refer to the same parameter by the name and the number.
But the conflict is between two varargs parameters[vararg].name (number vararg+1) and p.name (number i).

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Perhaps the number is not needed. I agree it is better if we refer to both parameters by name.

@erlend-aasland

Copy link
Copy Markdown
ContributorAuthor

Perhaps 94e082e is overdoing it.

@erlend-aasland

Copy link
Copy Markdown
ContributorAuthor

I'll have to start this branch over again; closing.

@erlend-aasland
erlend-aasland deleted the clinic/better-error-messages branch October 15, 2024 20:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@erlend-aasland@serhiy-storchaka@sobolevn