Aivar Annamaa added the comment:

Regarding #16795, the documentation says "The lineno is the line number of 
source text and the col_offset is the UTF-8 byte offset of the first token that 
generated the node", not that lineno and col_offset indicate a suitable 
position to mention in the error messages related to this node.

IMO lineno and col_offset should stay as predictable means for finding the 
(beginning of) source text of the node. In error reporting code one could 
inspect the situation and compute locations suitable for this.

Alternatively, these attributes could be left for purposes mentioned in #16795 
and parser developers could introduce new attributes in ast nodes which 
indicate both start and end positions of corresponding source. (Hopefully this 
would resolve also #18374 and #16806)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to