-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Argument Clinic omits name of keyword-only parameter on _PyArg_BadArgument() call #81215
Comments
Example of generated code: if (!PyBytes_Check(args[15])) {
_PyArg_BadArgument("replace", 16, "bytes", args[15]);
goto exit;
} Error message: TypeError: replace() argument 16 must be bytes, not tuple It is the 'lnotab' parameter which is a keywoard-only parameter. I expect the parameter name in the error message. Note: I got this error while implementing bpo-37032. |
With the attached PR, the error message is now: >>> def f(): pass
...
>>> code = f.__code__
>>> code.replace(co_lnotab=4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: replace() argument 'co_lnotab' must be bytes, not int |
This is a bug. I intentionally committed the simpler code, but forgot to fix it later. |
I suggest to also apply the fix to 3.8 in that case. |
Thank you Rémi! |
Thanks, that's a great enhancement! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: