Skip to content

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

Closed

Description

@hyperkai

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

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    and removed
    stdlibStandard Library Python modules in the Lib/ directory
    on May 4, 2025
  2. picnixz commented on May 4, 2025

    @picnixz
    Member

    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)

  3. added a commit that references this issue on May 10, 2025
  4. serhiy-storchaka commented on May 10, 2025

    @serhiy-storchaka
    Member

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

    Thank you for your PR, @StanFromIreland.

  5. hyperkai commented on May 11, 2025

    @hyperkai
    ContributorAuthor

    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
  6. StanFromIreland commented on May 11, 2025

    @StanFromIreland
    Member

    You need to pull the latest commits and build again.

  7. added a commit that references this issue on Jul 12, 2025
  8. added a commit that references this issue on Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-parsertype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions