From 025eb98dc0c1dc27404df6c544fc2944e0fa9f3a Mon Sep 17 00:00:00 2001 From: Ammar Askar Date: Mon, 24 Sep 2018 17:12:49 -0400 Subject: bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338) Also point to start of tokens in parsing errors. Fixes bpo-34683 --- Python/compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/compile.c') diff --git a/Python/compile.c b/Python/compile.c index 707da79ab6..3a45804580 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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); -- cgit v1.2.1