-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Syntactically wrong suggestions by the new custom print statement error message #76209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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:
The "int" next to the left brace of the suggested print function is obviously wrong.
Using other values or "%s" in the formatted string in a print statement produces the same wrong message. I am attaching the minimal example file in this bug report. Running it with "$ python3 print.py" should show the mentioned bug. |
Given the symptoms (stripping 4 spaces + "pr" from the start of the line, leaving "int " behind), it looks like we're not stripping the leading whitespace when determining the text to include in the suggested print() call. To reproduce this at the REPL, you can use an if statement (first example uses a 4 space indent, the second uses an 8 space indent):
|
Sure, let me have a look at it and work on fix. |
Thanks CuriousLearner for the PR and mdraw for the original issue report! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: