summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-08-01 01:10:50 (GMT)
committerGitHub <noreply@github.com>2021-08-01 01:10:50 (GMT)
commit208a7e957b812ad3b3733791845447677a704f3e (patch)
tree5af298f98c8ceea7d731ae14f3770e4b6e1fbdc0 /Lib
parentb08c48e61745666df9aeee97d8bddbf1e5550627 (diff)
downloadcpython-208a7e957b812ad3b3733791845447677a704f3e.zip
cpython-208a7e957b812ad3b3733791845447677a704f3e.tar.gz
cpython-208a7e957b812ad3b3733791845447677a704f3e.tar.bz2
bpo-34013: Don't consider a grouped expression when reporting legacy print syntax errors (GH-27521)
Diffstat (limited to 'Lib')
-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 8ea415f..b280cfe 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)