Arminius <[email protected]> added the comment:
There is another instance of incorrectly reported offsets in f-strings, in this
case affecting multi-line strings.
Example:
(
f'aaa{foo}bbb'
f'ccc{bar}ddd'
f'eee{baz}fff'
)
Relevant part of the syntax tree:
JoinedStr(
lineno=2,
col_offset=4,
values=[
Str(lineno=2, col_offset=4, s='aaa'),
FormattedValue(
lineno=2,
col_offset=4,
value=Name(lineno=2, col_offset=10, id='foo', ctx=Load()),
conversion=-1,
format_spec=None,
),
Str(lineno=2, col_offset=4, s='bbbccc'),
FormattedValue(
lineno=2,
col_offset=4,
value=Name(lineno=2, col_offset=5, id='bar', ctx=Load()),
conversion=-1,
format_spec=None,
),
Str(lineno=2, col_offset=4, s='dddcccaaaaaaaaaaaaaa'),
FormattedValue(
lineno=2,
col_offset=4,
value=Name(lineno=2, col_offset=5, id='baz', ctx=Load()),
conversion=-1,
format_spec=None,
),
Str(lineno=2, col_offset=4, s='ddd'),
],
),
The reported code position for "foo" is correct (2,10), but not for "bar" (2,5)
and "baz" (2,5).
Could you give an estimate as to whether this issue will be looked at any time
soon?
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35212>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com