Message363375
This is tested in CPython master. The issue also occurs in older versions of Python.
>>> ast.dump(ast.parse('f"{x}"'))
"Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=-1, format_spec=None)]))], type_ignores=[])"
>>> ast.dump(ast.parse('f"{x!r}"'))
"Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=114, format_spec=None)]))], type_ignores=[])"
>>> ast.parse('f"{x}"').body[0].value.values[0].value.col_offset
3
>>> ast.parse('f"{x!r}"').body[0].value.values[0].value.col_offset
1
The col_offset for the variable x should be 3 in both instances. |
|
Date |
User |
Action |
Args |
2020-03-04 18:41:51 | asmeurer | set | recipients:
+ asmeurer |
2020-03-04 18:41:51 | asmeurer | set | messageid: <1583347311.91.0.313226476752.issue39854@roundup.psfhosted.org> |
2020-03-04 18:41:51 | asmeurer | link | issue39854 messages |
2020-03-04 18:41:51 | asmeurer | create | |
|