diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2022-12-07 13:52:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-07 13:52:05 (GMT) |
commit | 72cfe5b1b9ad1bbe9da38a5af605e5d03ad88147 (patch) | |
tree | d8c9df6a1732d0d14c4e91e1cc6d14a425b69a35 /Lib/test | |
parent | 3843973cfd5267018791facb77609aff0455074b (diff) | |
download | cpython-72cfe5b1b9ad1bbe9da38a5af605e5d03ad88147.zip cpython-72cfe5b1b9ad1bbe9da38a5af605e5d03ad88147.tar.gz cpython-72cfe5b1b9ad1bbe9da38a5af605e5d03ad88147.tar.bz2 |
[3.10] gh-100050: Fix an assertion error when raising unclosed parenthesis errors in the tokenizer (GH-100065) (#100073)
Automerge-Triggered-By: GH:pablogsal.
(cherry picked from commit 97e7004cfe48305bcd642c653b406dc7470e196d)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_syntax.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 5f2528b..cd09d1e 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -1587,6 +1587,22 @@ def func2(): for paren in ")]}": self._check_error(paren + "1 + 2", f"unmatched '\\{paren}'") + # Some more complex examples: + code = """\ +func( + a=["unclosed], # Need a quote in this comment: " + b=2, +) +""" + self._check_error(code, "parenthesis '\\)' does not match opening parenthesis '\\['") + + def test_error_string_literal(self): + + self._check_error("'blech", "unterminated string literal") + self._check_error('"blech', "unterminated string literal") + self._check_error("'''blech", "unterminated triple-quoted string literal") + self._check_error('"""blech', "unterminated triple-quoted string literal") + def test_match_call_does_not_raise_syntax_error(self): code = """ def match(x): |