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 benjamin.peterson
Recipients benjamin.peterson, emilyemorehouse, gvanrossum
Date 2018-09-14.18:21:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536949265.86.0.956365154283.issue34683@psf.upfronthosting.co.za>
In-reply-to
Content
I think ast.c is in the right here and there are two complementary bugs in caret printing and the parser.

print_error_text does this:

    while (--offset > 0)
        PyFile_WriteString(" ", f);

which is off-by-one if offset is zero-indexed (which it should be IMO).

The parser has an off-by-one error in the other direction. When it reports an error, it reports the offset of the tokenizer's "cur" buffer. This is generally advanced past the location that actually resulted in a parser error. I believe the parser should be fixed to report the error offset as the offset of the start of the token that caused the error.
History
Date User Action Args
2018-09-14 18:21:05benjamin.petersonsetrecipients: + benjamin.peterson, gvanrossum, emilyemorehouse
2018-09-14 18:21:05benjamin.petersonsetmessageid: <1536949265.86.0.956365154283.issue34683@psf.upfronthosting.co.za>
2018-09-14 18:21:05benjamin.petersonlinkissue34683 messages
2018-09-14 18:21:05benjamin.petersoncreate