This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mjpieters
Recipients mjpieters
Date 2017-08-09.13:31:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502285478.81.0.436457469881.issue31161@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-08-09 13:31:18mjpieterssetrecipients: + mjpieters
2017-08-09 13:31:18mjpieterssetmessageid: <1502285478.81.0.436457469881.issue31161@psf.upfronthosting.co.za>
2017-08-09 13:31:18mjpieterslinkissue31161 messages
2017-08-09 13:31:18mjpieterscreate