summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorAmmar Askar <ammar_askar@hotmail.com>2018-09-24 21:12:49 (GMT)
committerGuido van Rossum <guido@python.org>2018-09-24 21:12:49 (GMT)
commit025eb98dc0c1dc27404df6c544fc2944e0fa9f3a (patch)
treead93cb6963abd43430766fa85b629b2d5896889b /Python/ast.c
parent223e501fb9c2b6ae21b96054e20c4c31d94a5d96 (diff)
downloadcpython-025eb98dc0c1dc27404df6c544fc2944e0fa9f3a.zip
cpython-025eb98dc0c1dc27404df6c544fc2944e0fa9f3a.tar.gz
cpython-025eb98dc0c1dc27404df6c544fc2944e0fa9f3a.tar.bz2
bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)
Also point to start of tokens in parsing errors. Fixes bpo-34683
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c
index b93eb88..b2fcb21 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);