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
Incorrect line reported in syntax error #90395
Comments
parsing this code results in a syntax error with an incorrect line number - it's always 1
resulting in: File "<stdin>", line 1 an analogue error occurs when parsing a file instead of stdin. This bug looks like it's another instance of https://bugs.python.org/issue42209 - I commented there but there was no response for two weeks - I hope it's OK to post a new bug.
|
Since bpo-42209 was closed, a new issue seems OK. As a result of the incorrect line number, IDLE highlights one of the opening quotes on line 1. |
This also affects 3.9 I imagine, no? |
Yes. And, from what I can tell, the same incorrect line is indicated at least all the way back to Python 3.6 (where it was "invalid token" instead of "invalid decimal literal). |
Please Andre and Terry, test this fix as much as you want. I am quite sure is correct, but it is far-reaching so I want to make sure every situation that we can think of is correct (and remains correct). |
I did some testing on my own using a code generator and a bunch of weird cases and I am confident this works. I am going to include this in the next alpha but will wait for your validation for some days before merging the backports. |
Backporting this to 3.9 is a bit more challenging and more changes are required, so I am not backporting for 3.9 to avoid unintended side effects. |
I understand. I think that for IDLE, I should check that the error .text is in the line indicated, and if not, recover somehow rather than blindly marking the the indicated column. For a shell statement entry, try to find the right line. Not sure for an editor syntax error. This is a rare situation in any case. |
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: