-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
col_offset for parenthesized expressions looks weird #83655
Labels
3.8 (EOL)
end of life
3.9
only security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
Comments
Python 3.9.0a2+ (heads/master:65ecc390c1, Jan 26 2020, 15:39:11)
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> source = "(2+2).source"
>>> ast.get_source_segment(source, ast.parse(source).body[0].value)
'2+2).source'
>>> source = "(2+2)[1]"
>>> ast.get_source_segment(source, ast.parse(source).body[0].value)
'2+2)[1]' I can prepare a patch to extend attribute's col_offset into parens if it is any if approved. |
This is also a 3.8 issue. We discovered this with pegen, and would love to see it fixed. |
Are you going to work on a patch then, Batuhan? |
Serhiy already submitted a PR, which looks great. |
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.8 (EOL)
end of life
3.9
only security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
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: