Skip to content

gh-133438: Fix the use of the terms "argument" and "parameter" in error messages for invalid function calls #135172

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jun 5, 2025

@serhiy-storchaka
Copy link
Member Author

There is yet one error message left (for arguments for positional-only parameters passed by keyword), but it is more significant change and I want to discuss it separately.

@serhiy-storchaka serhiy-storchaka changed the title gh-135160: Fix the use of the terms "argument" and "parameter" in error messages for invalid function calls gh-133438: Fix the use of the terms "argument" and "parameter" in error messages for invalid function calls Jun 5, 2025
…in error messages for invalid function calls
@serhiy-storchaka serhiy-storchaka force-pushed the errors-argument-vs-parameter branch from 68ec454 to e19eb6f Compare June 5, 2025 10:36
@@ -1318,7 +1318,7 @@ missing_arguments(PyThreadState *tstate, PyCodeObject *co,
Py_ssize_t i, j = 0;
Py_ssize_t start, end;
int positional = (defcount != -1);
const char *kind = positional ? "positional" : "keyword-only";
const char *kind = positional ? "positional" : "keyword";
Copy link
Member

Choose a reason for hiding this comment

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

Why not keeping keyword-only here, it's correct, no?

>>> def f(*, x): pass
... 
>>> f()
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    f()
    ~^^
TypeError: f() missing 1 required keyword-only argument: 'x'

Copy link
Member Author

Choose a reason for hiding this comment

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

"Keyword-only" is a qualifier of a parameter. Arguments can be "positional" or "keyword".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants