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

Pegen: Raise errors occurred by the AST validator #86372

Closed
isidentical opened this issue Oct 30, 2020 · 4 comments
Closed

Pegen: Raise errors occurred by the AST validator #86372

isidentical opened this issue Oct 30, 2020 · 4 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@isidentical
Copy link
Sponsor Member

BPO 42206
Nosy @gvanrossum, @lysnikolaou, @pablogsal, @isidentical
PRs
  • bpo-42206: Propagate and raise errors from PyAST_Validate in the parser #23035
  • 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-10-30.12:01:07.206>
    created_at = <Date 2020-10-30.10:09:19.673>
    labels = ['interpreter-core']
    title = 'Pegen: Raise errors occurred by the AST validator'
    updated_at = <Date 2020-10-30.12:01:07.206>
    user = 'https://github.com/isidentical'

    bugs.python.org fields:

    activity = <Date 2020-10-30.12:01:07.206>
    actor = 'BTaskaya'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-10-30.12:01:07.206>
    closer = 'BTaskaya'
    components = ['Interpreter Core']
    creation = <Date 2020-10-30.10:09:19.673>
    creator = 'BTaskaya'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42206
    keywords = ['patch']
    message_count = 4.0
    messages = ['379941', '379943', '379944', '379949']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'lys.nikolaou', 'pablogsal', 'BTaskaya']
    pr_nums = ['23035']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue42206'
    versions = []

    @isidentical
    Copy link
    Sponsor Member Author

    When working on the AST validator, it is unclear that which of the changes caused parser to fail on valid input. I propose to propagate the error and raise it.

    Current:
    $ ./python t.py
    python: Parser/pegen.c:1146: _PyPegen_run_parser: Assertion `PyAST_Validate(res)' failed.

    Proposed:
    $ ./python t.py
    ValueError: Test AST error raised by the Python/ast.c

    @isidentical isidentical added interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Oct 30, 2020
    @pablogsal
    Copy link
    Member

    This will slow down the parser massively. The reason we went' with the assert is so we only do the check in debug mode. We could propagate if you want, but it needs to be surrounded by debug preprocessor checks.

    @pablogsal
    Copy link
    Member

    This will slow down the parser massively. The reason we went' with the assert is so we only do the check in debug mode. We could propagate if you want, but it needs to be surrounded by debug preprocessor checks.

    Oh, I just checked and it currently is surrounded. Nevermind

    @pablogsal
    Copy link
    Member

    New changeset 3af4b58 by Batuhan Taskaya in branch 'master':
    bpo-42206: Propagate and raise errors from PyAST_Validate in the parser (GH-23035)
    3af4b58

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants