ironpython3
ironpython3 copied to clipboard
print and exec have custom syntax error messages when using old syntax
>>> print foo
File "<stdin>", line 1
print foo
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(foo)?
>>> exec foo
File "<stdin>", line 1
exec foo
^
SyntaxError: Missing parentheses in call to 'exec'
https://github.com/python/cpython/blob/43c0f1ac5ed8bc9c3bd048d2ce4de4c98a83de99/Objects/exceptions.c#L2893
There are tests for these in:
- test_grammar.test_former_statements_refer_to_builtins
- test_print.TestPy2MigrationHint (in 3.6)
- test_exceptions.testSyntaxErrorMissingParens (in 3.6)