summaryrefslogtreecommitdiff
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-31 18:31:44 -0700
committerGitHub <noreply@github.com>2021-07-31 18:31:44 -0700
commit35035bc35a9cb8617ab9fe9aac38aaf67c926aef (patch)
tree2e38ea548c1baa345afb23550f658f05f54f8b24 /Lib/test/test_exceptions.py
parent76903ff9ce2d28f542c44ba97aa043dde8b55daa (diff)
downloadcpython-git-35035bc35a9cb8617ab9fe9aac38aaf67c926aef.tar.gz
bpo-34013: Don't consider a grouped expression when reporting legacy print syntax errors (GH-27521)
(cherry picked from commit 208a7e957b812ad3b3733791845447677a704f3e) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 8ffebebaeb..339801ebae 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -182,6 +182,15 @@ class ExceptionTests(unittest.TestCase):
s = 'exec f(a+b,c)'
ckmsg(s, "Missing parentheses in call to 'exec'. Did you mean exec(...)?")
+ # Check that we don't incorrectly identify '(...)' as an expression to the right
+ # of 'print'
+
+ s = 'print (a+b,c) $ 42'
+ ckmsg(s, "invalid syntax")
+
+ s = 'exec (a+b,c) $ 42'
+ ckmsg(s, "invalid syntax")
+
# 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)