classification
Title: Pegen: Raise errors occurred by the AST validator
Type: Stage: resolved
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, gvanrossum, lys.nikolaou, pablogsal
Priority: normal Keywords: patch

Created on 2020-10-30 10:09 by BTaskaya, last changed 2020-10-30 12:01 by BTaskaya. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23035 merged BTaskaya, 2020-10-30 10:12
Messages (4)
msg379941 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2020-10-30 10:09
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
msg379943 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-10-30 10:27
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.
msg379944 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-10-30 10:28
> 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
msg379949 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-10-30 11:49
New changeset 3af4b585527743e455145d294049c46b7c823ed9 by Batuhan Taskaya in branch 'master':
bpo-42206: Propagate and raise errors from PyAST_Validate in the parser (GH-23035)
https://github.com/python/cpython/commit/3af4b585527743e455145d294049c46b7c823ed9
History
Date User Action Args
2020-10-30 12:01:07BTaskayasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-10-30 11:49:10pablogsalsetmessages: + msg379949
2020-10-30 10:28:12pablogsalsetmessages: + msg379944
2020-10-30 10:27:25pablogsalsetmessages: + msg379943
2020-10-30 10:12:22BTaskayasetkeywords: + patch
stage: patch review
pull_requests: + pull_request21954
2020-10-30 10:09:19BTaskayacreate