gh-99153: set location on SyntaxError for try with both except and except* (GH-99160)

This commit is contained in:
Irit Katriel 2022-11-06 15:36:19 +00:00 committed by GitHub
parent d3b82b4463
commit 61b6c40b64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 5 deletions

View file

@ -2014,6 +2014,16 @@ def test_generator_in_function_call(self):
"Generator expression must be parenthesized",
lineno=1, end_lineno=1, offset=11, end_offset=53)
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)
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)
def test_empty_line_after_linecont(self):
# See issue-40847
s = r"""\