bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)

Also point to start of tokens in parsing errors.

Fixes bpo-34683
This commit is contained in:
Ammar Askar 2018-09-24 17:12:49 -04:00 committed by Guido van Rossum
parent 223e501fb9
commit 025eb98dc0
11 changed files with 65 additions and 21 deletions

View file

@ -4830,7 +4830,7 @@ compiler_error(struct compiler *c, const char *errstr)
loc = Py_None;
}
u = Py_BuildValue("(OiiO)", c->c_filename, c->u->u_lineno,
c->u->u_col_offset, loc);
c->u->u_col_offset + 1, loc);
if (!u)
goto exit;
v = Py_BuildValue("(zO)", errstr, u);