summaryrefslogtreecommitdiffstats
path: root/Python/future.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/future.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/future.c')
-rw-r--r--Python/future.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/future.c b/Python/future.c
index 4ea6827..1663a38 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -48,12 +48,12 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
} else if (strcmp(feature, "braces") == 0) {
PyErr_SetString(PyExc_SyntaxError,
"not a chance");
- PyErr_SyntaxLocationObject(filename, s->lineno, s->col_offset);
+ PyErr_SyntaxLocationObject(filename, s->lineno, s->col_offset + 1);
return 0;
} else {
PyErr_Format(PyExc_SyntaxError,
UNDEFINED_FUTURE_FEATURE, feature);
- PyErr_SyntaxLocationObject(filename, s->lineno, s->col_offset);
+ PyErr_SyntaxLocationObject(filename, s->lineno, s->col_offset + 1);
return 0;
}
}