New submission from Pablo Galindo Salgado <pablog...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue40147>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to