This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scummos
Recipients benjamin.peterson, georg.brandl, rhettinger, scummos, terry.reedy
Date 2010-12-26.12:46:09
SpamBayes Score 0.0028757378
Marked as misclassified No
Message-id <1293367585.59.0.17008691647.issue10769@psf.upfronthosting.co.za>
In-reply-to
Content
Hi,

yeah Terry, that's exactly what most people whom I talked about this said (me too).

Anyway, here's the patch which -- in my opinion -- fixes this behavior:

--- python-orig/Python/ast.c 2010-10-19 03:22:07.000000000 +0200
+++ python-ast-fix/Python/ast.c 2010-12-26 13:25:48.000000000 +0100
@@ -1742,8 +1742,6 @@
         tmp = ast_for_trailer(c, ch, e);
         if (!tmp)
             return NULL;
-        tmp->lineno = e->lineno;
-        tmp->col_offset = e->col_offset;
         e = tmp;
     }
     if (TYPE(CHILD(n, NCH(n) - 1)) == factor) {

The offsets for "foo.bar.baz" before the patch:

[1, 0, <_ast.Attribute>]
[1, 0, <_ast.Attribute>, 'baz']
[1, 0, <_ast.Name>, 'bar']
[1, 0, 'foo']

... and after the patch:

[1, 0, <_ast.Attribute>]
[1, 7, <_ast.Attribute>, 'baz']
[1, 3, <_ast.Name>, 'bar']
[1, 0, 'foo']

It would really be great if that could be applied.

Best regards,
Sven
History
Date User Action Args
2010-12-26 12:46:25scummossetrecipients: + scummos, georg.brandl, rhettinger, terry.reedy, benjamin.peterson
2010-12-26 12:46:25scummossetmessageid: <1293367585.59.0.17008691647.issue10769@psf.upfronthosting.co.za>
2010-12-26 12:46:10scummoslinkissue10769 messages
2010-12-26 12:46:09scummoscreate