-
Notifications
You must be signed in to change notification settings - Fork 0
Wrong column for invalid string prefix #121
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
Seems to be a general problem with errors from the tokenizer. Before:
After:
|
So the root cause of this is that the Lines 422 to 428 in 14ab84b
is based on the file offset when it does Lines 258 to 263 in 14ab84b
then the calculation needs to be adjusted so that it's relative to that line. Alternatively, we can pass the entire file up till the error to the SyntaxError to maintain consistency with what's been done so far. |
If the col offset is ever from the start of the file that's a mistake. |
Is there a special reason to use |
No particular reason, except that last week everything needed to move fast and so I probably didn't think too hard about alternative ways to do things, actually I just did what seemed easier. Thanks a lot for taking the time to look into this! 😃 Would you be able to open a PR with your code? This really sounds like a good improvement. |
Yes, but @pablogsal suggested that I should fix all errors in that syntax error test (in test_exceptions) in once, so still working on. I'll make it ready ASAP before the |
That'd be great! |
Thanks for working on this! Just a tip, the existing column numbers are generally based off this rule. Lines 419 to 421 in 14ab84b
|
Fixed in python#19782. |
Not completely, we are still missing the offsets that come from the AST |
Are those related to invalid string prefixes? |
No, they are just some incorrect column offsets. Are we tracking those in a different issue? |
Oh, we are: #65 Sorry, we can indeed close this issue :) |
Example input:
Expected output:
Actual (with new parser):
The text was updated successfully, but these errors were encountered: