Message300002
SyntaxError.__init__() checks for the `print` and `exec` error cases where the user forgot to use parentheses:
>>> exec 1
File "<stdin>", line 1
exec 1
^
SyntaxError: Missing parentheses in call to 'exec'
>>> print 1
File "<stdin>", line 1
print 1
^
SyntaxError: Missing parentheses in call to 'print'
However, this check is also applied to *subclasses* of SyntaxError:
>>> if True:
... print "Look ma, no parens!"
File "<stdin>", line 2
print "Look ma, no parens!"
^
IndentationError: Missing parentheses in call to 'print'
and
>>> compile('if 1:\n 1\n\tprint "Look ma, tabs!"', '', 'single')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "", line 3
print "Look ma, tabs!"
^
TabError: Missing parentheses in call to 'print'
Perhaps the check needs to be limited to just the exact type. |
|
Date |
User |
Action |
Args |
2017-08-09 13:31:18 | mjpieters | set | recipients:
+ mjpieters |
2017-08-09 13:31:18 | mjpieters | set | messageid: <1502285478.81.0.436457469881.issue31161@psf.upfronthosting.co.za> |
2017-08-09 13:31:18 | mjpieters | link | issue31161 messages |
2017-08-09 13:31:18 | mjpieters | create | |
|