mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[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 97e7004cfe
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
3843973cfd
commit
72cfe5b1b9
3 changed files with 22 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue