[issue10769] ast: provide more useful range information

Benjamin Peterson report at bugs.python.org
Sat Dec 25 01:51:31 CET 2010


Benjamin Peterson <benjamin at python.org> added the comment:

2010/12/24 Sven Brauch <report at bugs.python.org>:
>
> Sven Brauch <svenbrauch at googlemail.com> added the comment:
>
> Hi,
>
> I found the reason for this behavior in the code now, it's in Python/ast.c, lines 1745 and 1746 in ast_for_power():
>
>        tmp->lineno = e->lineno;
>        tmp->col_offset = e->col_offset;
>
> Here, the range information for the individual attributes (which is correctly set before!) is being discarded and replaced by the useless information from the expression ast.
> I don't see any reason for this, is there one? :)
>
> Removing those two lines doesn't seem to break anything and sets ranges correctly.

The ranges are correct. They just aren't what you want. The attribute
starts at the beginning of the power, not the ".".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10769>
_______________________________________


More information about the Python-bugs-list mailing list