Skip to content

Parameter's error messages say argument instead of parameter #133379

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

Closed
hyperkai opened this issue May 4, 2025 · 4 comments
Closed

Parameter's error messages say argument instead of parameter #133379

hyperkai opened this issue May 4, 2025 · 4 comments
Labels
3.15 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-parser type-bug An unexpected behavior, bug, or error

Comments

@hyperkai
Copy link

hyperkai commented May 4, 2025

Bug report

Bug description:

Setting the same name parameters gets the error message saying duplicate argument as shown below:

def func(param, param):
    pass

SyntaxError: duplicate argument 'param' in function definition

Setting * after all the parameters gets the error message saying at least one argument as shown below:

def func(param1, param2, *):
    pass

SyntaxError: named arguments must follow bare *

So, argument should be replaced with parameter as shown below:

SyntaxError: duplicate parameter 'param' in function definition

SyntaxError: named parameters must follow bare *

*You can also see this issue.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

@hyperkai hyperkai added the type-bug An unexpected behavior, bug, or error label May 4, 2025
@picnixz picnixz added stdlib Python modules in the Lib dir interpreter-core (Objects, Python, Grammar, and Parser dirs) and removed stdlib Python modules in the Lib dir labels May 4, 2025
@picnixz
Copy link
Member

picnixz commented May 4, 2025

Formally speaking, here we indeed need to use "parameter" and not "argument". However, we only change error messages in the latest version to reduce breakage possibilities (thus, I don't think we'll backport this)

@serhiy-storchaka
Copy link
Member

Thank you for your report, @hyperkai. It's amazing how long we ignored this mistake.

Thank you for your PR, @StanFromIreland.

@hyperkai
Copy link
Author

There are other error messages using argument instead of parameter as shown below:

def func(*args1, *args2): pass
# SyntaxError: * argument may appear only once

def func(**kwargs, *args): pass
# SyntaxError: arguments cannot follow var-keyword argument

def func(*args=["John"]): pass
# SyntaxError: var-positional argument cannot have default value

def func(**kwargs={"name":"John"}): pass
# SyntaxError: var-keyword argument cannot have default value

@StanFromIreland
Copy link
Contributor

You need to pull the latest commits and build again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.15 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-parser type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants