classification
Title: Move checking for duplicated keywords to the compiler
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, lys.nikolaou, pablogsal
Priority: normal Keywords: patch

Created on 2020-04-02 00:22 by pablogsal, last changed 2020-04-06 06:48 by pablogsal. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19289 merged pablogsal, 2020-04-02 00:24
PR 19389 merged ZackerySpytz, 2020-04-06 05:38
Messages (3)
msg365537 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-04-02 00:22
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.
msg365719 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-04-03 19:37
New changeset 254ec783411d9d16e51f1116f98918be2ef0e884 by Pablo Galindo in branch 'master':
bpo-40147: Move the check for duplicate keywords to the compiler (GH-19289)
https://github.com/python/cpython/commit/254ec783411d9d16e51f1116f98918be2ef0e884
msg365841 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-04-06 06:48
New changeset 08050e959e6c40839cd2c9e5f6a4fd1513e3d605 by Zackery Spytz in branch 'master':
bpo-40147: Fix a compiler warning on Windows in Python/compile.c (GH-19389)
https://github.com/python/cpython/commit/08050e959e6c40839cd2c9e5f6a4fd1513e3d605
History
Date User Action Args
2020-04-06 06:48:03pablogsalsetmessages: + msg365841
2020-04-06 05:38:31ZackerySpytzsetnosy: + ZackerySpytz

pull_requests: + pull_request18752
2020-04-03 19:42:15pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-04-03 19:37:20pablogsalsetmessages: + msg365719
2020-04-02 00:24:04pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request18648
2020-04-02 00:23:07pablogsalsetnosy: + lys.nikolaou
2020-04-02 00:22:24pablogsalcreate