Message361456
When concatenating f-strings, if there is an expression in any STRING node other than the first, col_offset of the parsed expression has a wrong value.
For example, parsing f"hello" f"{world}" outputs the following AST:
Module(
body=[
Expr(
value=JoinedStr(
values=[
Constant(
value="hello",
kind=None,
lineno=1,
col_offset=0,
end_lineno=1,
end_col_offset=19,
),
FormattedValue(
value=Name(
id="world",
ctx=Load(),
lineno=1,
*col_offset=1,*
end_lineno=1,
*end_col_offset=6,*
),
conversion=-1,
format_spec=None,
lineno=1,
col_offset=0,
end_lineno=1,
end_col_offset=19,
),
],
lineno=1,
col_offset=0,
end_lineno=1,
end_col_offset=19,
),
lineno=1,
col_offset=0,
end_lineno=1,
end_col_offset=19,
)
],
type_ignores=[],
)
Here, col_offset and end_col_offset are wrong in the parsed NAME 'world'. |
|
Date |
User |
Action |
Args |
2020-02-05 21:21:22 | lys.nikolaou | set | recipients:
+ lys.nikolaou, gvanrossum, pablogsal |
2020-02-05 21:21:22 | lys.nikolaou | set | messageid: <1580937682.24.0.516632817266.issue39564@roundup.psfhosted.org> |
2020-02-05 21:21:22 | lys.nikolaou | link | issue39564 messages |
2020-02-05 21:21:21 | lys.nikolaou | create | |
|