mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-34013: Don't consider a grouped expression when reporting legacy print syntax errors (GH-27521)
(cherry picked from commit 208a7e957b
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
76903ff9ce
commit
35035bc35a
3 changed files with 17 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue