mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-42218: Correctly handle errors in left-recursive rules (GH-23065)
Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
d21cb2d5ee
commit
02cdfc93f8
4 changed files with 32 additions and 0 deletions
|
@ -972,6 +972,14 @@ def func2():
|
|||
"""
|
||||
self._check_error(code, "invalid syntax")
|
||||
|
||||
def test_invalid_line_continuation_left_recursive(self):
|
||||
# Check bpo-42218: SyntaxErrors following left-recursive rules
|
||||
# (t_primary_raw in this case) need to be tested explicitly
|
||||
self._check_error("A.\u018a\\ ",
|
||||
"unexpected character after line continuation character")
|
||||
self._check_error("A.\u03bc\\\n",
|
||||
"unexpected EOF while parsing")
|
||||
|
||||
def test_main():
|
||||
support.run_unittest(SyntaxTestCase)
|
||||
from test import test_syntax
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue