[Python-Dev] Tweaking AST lineno and col_offset

Frank Wierzbicki fwierzbicki at gmail.com
Fri Aug 14 17:46:46 CEST 2009

Hi all,

Off and on I have been directly comparing Jython's AST with Python's
AST and generally working towards making them as close to identical as
possible.  There are a couple of places where I haven't "fixed" Jython
because it looks to me like Jython has slightly better offsets.  One

for a,b in c:

The Tuple node "a,b" ends up with a col_offset of 0 (the position of
the "for") where Jython has the col_offset as 4 (the position of "a").
 Jython's result is more consistent with other Tuple node col_offset

I have a local patch that changes the CPython col_offset to match
Jython's, but before I submit a patch I thought I'd ask here if there
is support for this sort of change and if I should continue to find
col_offset and lineno results that look fishy to me, or should I just
change Jython's results to match (one way or another, things will be
much easier for me to test if they match).

Also, would this be a change that would be considered a backwards
incompatibility?  In other words, would patches like this be allowed
in 2.6/3.1 or only in 2.7/3.2.



More information about the Python-Dev mailing list