Skip to content

Ensure that CodeAst nodes always start at (0, 0).

Francis Herne requested to merge flherne/kdev-python:flh-attr-range into 5.6

Previously the start was that of the first child node.

From CPython 3.8.2, the range of an attribute access (expr).blah includes the leading parenthesis, and thus starts before expr.

The range of kdev-python's Attribute node represents only the range of blah, and is calculated in an awkward way.

When an attribute access of a parenthesized expression appeared at the start of a file, the start of the attribute range from CPython was before that of the CodeAst node (based on the start of expr) resulting in an incorrect range being calculated.

This case is very unusual in real code, but fixes the tests. ;-)

Merge request reports