[New-bugs-announce] [issue40147] Move checking for duplicated keywords to the compiler

Pablo Galindo Salgado report at bugs.python.org
Wed Apr 1 20:22:24 EDT 2020


New submission from Pablo Galindo Salgado <pablogsal at gmail.com>:

When a keyword is repeated in a call for instance:

'f(1, x=2, *(3, 4), x=5)'

we raise a SyntaxError:

  File "lel.py", line 1
    f(1, x=2, *(3, 4), x=5)
                       ^
SyntaxError: keyword argument repeated

This error is raised from the AST but there is nothing technically wrong with that code from the grammar perspective. Indeed, the grammar must accepts that code, but the check must fail later (in the compiler for instance) because the code is semantically invalid. When working on the new PEG parser we have encountered this situation and changing the parser would remove the check as it is right now. For these reasons, the check should be moved from the AST to the compiler.

----------
messages: 365537
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Move checking for duplicated keywords to the compiler

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40147>
_______________________________________


More information about the New-bugs-announce mailing list