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/ast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/ast.c') diff --git a/Python/ast.c b/Python/ast.c index b93eb88dae..b2fcb21975 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -683,7 +683,7 @@ ast_error(struct compiling *c, const node *n, const char *errmsg) Py_INCREF(Py_None); loc = Py_None; } - tmp = Py_BuildValue("(OiiN)", c->c_filename, LINENO(n), n->n_col_offset, loc); + tmp = Py_BuildValue("(OiiN)", c->c_filename, LINENO(n), n->n_col_offset + 1, loc); if (!tmp) return 0; errstr = PyUnicode_FromString(errmsg); -- cgit v1.2.1