New submission from Martin Drawitsch <[email protected]>:
I think I found a bug in the new print syntax suggestion introduced by
https://bugs.python.org/issue30597.
When the following code is executed by Python 3.6.3 inside of a .py file:
def f():
print '%d' % 2
, then Python gives the following error message:
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(int
'%d' % 2)?
The "int" next to the left brace of the suggested print function is obviously
wrong.
The expected message would be:
SyntaxError: Missing parentheses in call to 'print'. Did you mean
print('%d' % 2)?
Using other values or "%s" in the formatted string in a print statement
produces the same wrong message.
This bug only seems to happen when the print statement is inside of a function
AND when it is is run inside of a .py file. At least I could not reproduce it
in the python3 REPL or outside of a function.
I am attaching the minimal example file in this bug report. Running it with "$
python3 print.py" should show the mentioned bug.
----------
components: Interpreter Core
files: print.py
messages: 306231
nosy: CuriousLearner, mdraw, ncoghlan
priority: normal
severity: normal
status: open
title: Syntactically wrong suggestions by the new custom print statement error
message
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47265/print.py
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32028>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com