[3.11] gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215) (GH-99622)

gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215)

(cherry picked from commit 9c4232ae89)
This commit is contained in:
Lysandros Nikolaou 2022-11-20 19:29:05 +01:00 committed by GitHub
parent 56a517e9e8
commit 152a437b8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1018 additions and 974 deletions

View file

@ -1988,12 +1988,12 @@ class SyntaxTestCase(unittest.TestCase):
def test_except_then_except_star(self):
self._check_error("try: pass\nexcept ValueError: pass\nexcept* TypeError: pass",
r"cannot have both 'except' and 'except\*' on the same 'try'",
lineno=1, end_lineno=1, offset=1, end_offset=4)
lineno=3, end_lineno=3, offset=1, end_offset=8)
def test_except_star_then_except(self):
self._check_error("try: pass\nexcept* ValueError: pass\nexcept TypeError: pass",
r"cannot have both 'except' and 'except\*' on the same 'try'",
lineno=1, end_lineno=1, offset=1, end_offset=4)
lineno=3, end_lineno=3, offset=1, end_offset=7)
def test_empty_line_after_linecont(self):
# See issue-40847