[3.10] bpo-34013: Generalize the invalid legacy statement error message (GH-27389). (GH-27391)
(cherry picked from commit 6948964ecf94e858448dd28eea634317226d2913)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index a2bc62b..8caac2c 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -175,9 +175,15 @@ def ckmsg(src, msg, exception=SyntaxError):
ckmsg(s, "Missing parentheses in call to 'print'. "
"Did you mean print(\"old style\", end=\" \")?")
+ s = 'print f(a+b,c)'
+ ckmsg(s, "Missing parentheses in call to 'print'.")
+
s = '''exec "old style"'''
ckmsg(s, "Missing parentheses in call to 'exec'")
+ s = 'exec f(a+b,c)'
+ ckmsg(s, "Missing parentheses in call to 'exec'.")
+
# should not apply to subclasses, see issue #31161
s = '''if True:\nprint "No indent"'''
ckmsg(s, "expected an indented block after 'if' statement on line 1", IndentationError)
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index ad5656b..6e1531e 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -1305,7 +1305,7 @@ def test_expression_with_assignment(self):
)
def test_curly_brace_after_primary_raises_immediately(self):
- self._check_error("f{", "invalid syntax", mode="single")
+ self._check_error("f{}", "invalid syntax", mode="single")
def test_assign_call(self):
self._check_error("f() = 1", "assign")