-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-115077: Make some Argument Clinic error messages more helpful #115078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-115077: Make some Argument Clinic error messages more helpful #115078
Conversation
Tools/clinic/clinic.py
Outdated
@@ -5019,7 +5021,8 @@ def at_classmethod(self) -> None: | |||
|
|||
def at_critical_section(self, *args: str) -> None: | |||
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") |
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.
f"{len(args)} was given") | |
f"{len(args)} were given") |
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.
Perhaps also print them out?
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@sobolevn, feel free to contribute to this branch/PR. |
Tools/clinic/clinic.py
Outdated
fail("Cannot specify multiple varargs; " | ||
f"'*{parameters[vararg].name}' was already provided as parameter {vararg+1}") |
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.
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
).
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.
Perhaps the number is not needed. I agree it is better if we refer to both parameters by name.
Perhaps 94e082e is overdoing it. |
I'll have to start this branch over again; closing. |
Uh oh!
There was an error while loading. Please reload this page.