-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
The AST for dict and set displays has the lineno of the first value #69318
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
Hi, In Python 3.5, the lineno for dict and set display ASTs is the line number of the first value, not the line number of the display character, as it was until 3.5. Here's an example: from ast import parse
module = parse('''{
'1':'2',
}
''')
dict_display = module.body[0].value
print(dict_display.lineno) I don't seem to find anything related to this in the documentation, but I presume this is a side effect of the new parser changes. It would nice to have this fixed or at least documented. |
Using hg bisect, I found the revision a65f685ba8c0: changeset: 95886:a65f685ba8c0 Patch by Neil Girdhar. |
A fix should include a new ast test, such as |
New changeset 4f14afc959df by Benjamin Peterson in branch '3.5': New changeset 9d895c09c08a by Benjamin Peterson in branch 'default': |
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: