Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move checking for duplicated keywords to the compiler #84328

Closed
pablogsal opened this issue Apr 2, 2020 · 3 comments
Closed

Move checking for duplicated keywords to the compiler #84328

pablogsal opened this issue Apr 2, 2020 · 3 comments

Comments

@pablogsal
Copy link
Member

BPO 40147
Nosy @lysnikolaou, @ZackerySpytz, @pablogsal
PRs
  • bpo-40147: Move the check for duplicate keywords to the compiler #19289
  • bpo-40147: Fix a compiler warning on Windows in Python/compile.c #19389
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-04-03.19:42:15.142>
    created_at = <Date 2020-04-02.00:22:24.878>
    labels = []
    title = 'Move checking for duplicated keywords to the compiler'
    updated_at = <Date 2020-04-06.06:48:03.533>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2020-04-06.06:48:03.533>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-03.19:42:15.142>
    closer = 'pablogsal'
    components = []
    creation = <Date 2020-04-02.00:22:24.878>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40147
    keywords = ['patch']
    message_count = 3.0
    messages = ['365537', '365719', '365841']
    nosy_count = 3.0
    nosy_names = ['lys.nikolaou', 'ZackerySpytz', 'pablogsal']
    pr_nums = ['19289', '19389']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40147'
    versions = []

    @pablogsal
    Copy link
    Member Author

    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.

    @pablogsal
    Copy link
    Member Author

    New changeset 254ec78 by Pablo Galindo in branch 'master':
    bpo-40147: Move the check for duplicate keywords to the compiler (GH-19289)
    254ec78

    @pablogsal
    Copy link
    Member Author

    New changeset 08050e9 by Zackery Spytz in branch 'master':
    bpo-40147: Fix a compiler warning on Windows in Python/compile.c (GH-19389)
    08050e9

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant