mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
add column offset to all syntax errors
This commit is contained in:
parent
2bc5c0be01
commit
d4efd9eb15
6 changed files with 60 additions and 40 deletions
|
@ -44,12 +44,12 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename)
|
|||
} else if (strcmp(feature, "braces") == 0) {
|
||||
PyErr_SetString(PyExc_SyntaxError,
|
||||
"not a chance");
|
||||
PyErr_SyntaxLocation(filename, s->lineno);
|
||||
PyErr_SyntaxLocationEx(filename, s->lineno, s->col_offset);
|
||||
return 0;
|
||||
} else {
|
||||
PyErr_Format(PyExc_SyntaxError,
|
||||
UNDEFINED_FUTURE_FEATURE, feature);
|
||||
PyErr_SyntaxLocation(filename, s->lineno);
|
||||
PyErr_SyntaxLocationEx(filename, s->lineno, s->col_offset);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -98,8 +98,7 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename)
|
|||
if (done) {
|
||||
PyErr_SetString(PyExc_SyntaxError,
|
||||
ERR_LATE_FUTURE);
|
||||
PyErr_SyntaxLocation(filename,
|
||||
s->lineno);
|
||||
PyErr_SyntaxLocationEx(filename, s->lineno, s->col_offset);
|
||||
return 0;
|
||||
}
|
||||
if (!future_check_features(ff, s, filename))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue