-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Segfault in new PEG parser #85080
Comments
The input I bisected the change, and the behavior appears to have been introduced by 16ab070 (bpo-40334: Correctly identify invalid target in assignment errors (GH-20076) ) Steps to reproduce: $ echo 'p=p=' | /path/to/python3.10
=== SIGSEGV (Address boundary error) Analysis: This code is an invalid assignment, and the parser tries to generate a useful message for this case (invalid_assignment_rule). However, the The invalid_assignment_rule function tries to identify the target of the assignment, to create a useful description for the error menssage by calling
The result of this call is then passed unconditionally to _PyPegen_get_expr_name, which is expecting a statement, not NULL. Error happens here: pegen.c:164 |
https://buildbot.python.org/all/#builders/765/builds/51 The new test fails with the old parser: **********************************************************************
File "/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_syntax.py", line 66, in test.test_syntax
Failed example:
yield = 1
Expected:
Traceback (most recent call last):
SyntaxError: assignment to yield expression not possible
Got:
Traceback (most recent call last):
File "/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
File "<doctest test.test_syntax[10]>", line 1
yield = 1
^
SyntaxError: invalid syntax
**********************************************************************
1 items had failures:
1 of 108 in test.test_syntax |
Oh, it's already fixed by: |
I fixed it this morning in #20717 |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: