mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)
Also point to start of tokens in parsing errors. Fixes bpo-34683
This commit is contained in:
parent
223e501fb9
commit
025eb98dc0
11 changed files with 65 additions and 21 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue