Skip to content

Uninformative syntax errors from codeop._maybe_compile (IDLE Shell) #111366

Closed
@Mehdical-Man

Description

@Mehdical-Man
>>> def function(duplicate, duplicate):
...     pass
# Expected error message:
SyntaxError: duplicate argument 'duplicate' in function definition
# Actual error message:
SyntaxError: incomplete input
>>> def global_and_parameter(argument, /):
...    global argument # It may not be clear for less experienced coders
                       # that a name cannot be global and parameter
SyntaxError: incomplete input
# However when executed with exec():
SyntaxError: name 'argument' is parameter and global

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions