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
FormattedValue expressions have wrong lineno and col_offset information #74650
Comments
f-strings are computed in a separate compiler step. This makes their lineno and col_offset information wrong. This is problematic for flake8 which reports problems inside f-strings on the wrong line (typically the first one). Attached patch fixes the issue. |
Thanks for adding so many tests. |
I have concerns about following cases.
f'{x} {x}' or f'''
f'''\ The tests look slightly verbose and fragile to me. If once the parser will produce more efficient tree (see bpo-26415), the tests may fail. Needed more tests (for cases mentioned above), and adding them will add more verbose code. Maybe just find the child (or several children) of specific type and check lineno and col_offset only for it and few its children? If this will make the tests simpler. But if tests can't be made simpler, we should live with this. |
See also bpo-31140: I'm not sure if that case is covered by this issue. |
Is there more to do on this issue or can it be closed now? |
I think it's fixed. Closing. |
lineno
andcol_offset
for multi-line string tokens. #10021Note: 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: