Apparently in Python 2 the col_offset of With nodes starts after the "with " text. This behavior is confusing and inconsistent with Python 3, which has the offset start at the beginning of the "with".
For an example of the issue, run the following commands:
This diff adds a test that the With node includes the "with" text, and corresponding behavior to fix up the start location when running under Python 3.
Thanks for this too. I felt I needed to experiment more, and found a case where it wasn't quite right. I added a test case for it and an alternative fix in #15 . Please take a look.
Apparently in Python 2 the
col_offset
ofWith
nodes starts after the "with " text. This behavior is confusing and inconsistent with Python 3, which has the offset start at the beginning of the "with".For an example of the issue, run the following commands:
This diff adds a test that the
With
node includes the "with" text, and corresponding behavior to fix up the start location when running under Python 3.