mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
[3.11] gh-99153: set location on SyntaxError for try with both except and except* (GH-99160) (#99168)
This commit is contained in:
parent
263e9830aa
commit
d8a42bcaf0
4 changed files with 16 additions and 5 deletions
|
@ -1985,6 +1985,16 @@ class SyntaxTestCase(unittest.TestCase):
|
|||
"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"""\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue