New submission from Lysandros Nikolaou <[email protected]>:
There is a problem with the end_col_offset of nested Attribute nodes in
decorators. For example, parsing
@a.b.c
def f(): pass
produces the following AST tree (part):
decorator_list=[
Attribute(
value=Attribute(
value=Name(
id="a",
ctx=Load(),
lineno=1,
col_offset=1,
end_lineno=1,
end_col_offset=2,
),
attr="b",
ctx=Load(),
lineno=1,
col_offset=1,
end_lineno=1,
*end_col_offset=6*,
),
attr="c",
ctx=Load(),
lineno=1,
col_offset=1,
end_lineno=1,
end_col_offset=6,
)
],
Note that the Attribute node with attr="b" has end_col_offset=6, while it
should actually be 4.
----------
components: Interpreter Core
messages: 361595
nosy: gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Attribute node in a decorator has wrong end_col_offset
versions: Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39579>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com