summaryrefslogtreecommitdiffstats
path: root/Python/future.c
diff options
context:
space:
mode:
authorBrian Schubert <brianm.schubert@gmail.com>2024-10-29 23:57:59 (GMT)
committerGitHub <noreply@github.com>2024-10-29 23:57:59 (GMT)
commit224c370a3680132997f1e43d20a3b4ca95a060ab (patch)
tree34fabd982364362ebf462c14aee621c42893ca8f /Python/future.c
parent9dfef4e5f4ac3c1ce494c48f2476a694c12d72a5 (diff)
downloadcpython-224c370a3680132997f1e43d20a3b4ca95a060ab.zip
cpython-224c370a3680132997f1e43d20a3b4ca95a060ab.tar.gz
cpython-224c370a3680132997f1e43d20a3b4ca95a060ab.tar.bz2
gh-126139: Improve error message location for future statement with unknown feature (#126140)
Diffstat (limited to 'Python/future.c')
-rw-r--r--Python/future.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/future.c b/Python/future.c
index 8aeb541..79b6c0c 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -41,12 +41,20 @@ 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 + 1);
+ PyErr_RangedSyntaxLocationObject(filename,
+ name->lineno,
+ name->col_offset + 1,
+ name->end_lineno,
+ name->end_col_offset + 1);
return 0;
} else {
PyErr_Format(PyExc_SyntaxError,
UNDEFINED_FUTURE_FEATURE, feature);
- PyErr_SyntaxLocationObject(filename, s->lineno, s->col_offset + 1);
+ PyErr_RangedSyntaxLocationObject(filename,
+ name->lineno,
+ name->col_offset + 1,
+ name->end_lineno,
+ name->end_col_offset + 1);
return 0;
}
}