[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

Steven D'Aprano report at bugs.python.org
Thu Aug 10 08:18:45 EDT 2017


Steven D'Aprano added the comment:

I'm not sure whether this is a bug or a feature.

In the examples you show, we have *both* an IndentationError/TabError and missing parentheses around print. So I'm almost inclined to say that this is right:

- you get an IndentationError (or TabError);

- and the error message *also* tells you that print is missing parens.

Two errors for the price of one!

I'm not sure that I would have designed it this way from scratch, but given that it already exists I'm not sure that it should be "fixed".

In any case, since the error message itself is not part of the public API, I don't think there's any problem in changing it in a bug-fix release. So *if* we change this, we can change it in 3.6.

----------
components: +Interpreter Core
nosy: +steven.daprano
type:  -> behavior
versions: +Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31161>
_______________________________________


More information about the Python-bugs-list mailing list