bpo-45738: Fix computation of error location for invalid continuation (GH-29550)

characters in the parser
(cherry picked from commit 25835c518a)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2021-11-13 17:30:03 -08:00 committed by GitHub
parent 28326ac5f8
commit bf26a6da7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 12 deletions

View file

@ -1487,7 +1487,13 @@ def func2():
def test_invalid_line_continuation_error_position(self):
self._check_error(r"a = 3 \ 4",
"unexpected character after line continuation character",
lineno=1, offset=9)
lineno=1, offset=8)
self._check_error('1,\\#\n2',
"unexpected character after line continuation character",
lineno=1, offset=4)
self._check_error('\nfgdfgf\n1,\\#\n2\n',
"unexpected character after line continuation character",
lineno=3, offset=4)
def test_invalid_line_continuation_left_recursive(self):
# Check bpo-42218: SyntaxErrors following left-recursive rules