Benjamin Peterson <benja...@python.org> added the comment:

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.

----------
nosy: +benjamin.peterson -eric.smith, xtreak

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34683>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to