mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Issue #25677: Merge SyntaxError caret positioning from 3.6
This commit is contained in:
commit
b46edf35f3
5 changed files with 39 additions and 5 deletions
|
@ -1138,11 +1138,8 @@ err_programtext(FILE *fp, int lineno)
|
|||
}
|
||||
fclose(fp);
|
||||
if (i == lineno) {
|
||||
char *p = linebuf;
|
||||
PyObject *res;
|
||||
while (*p == ' ' || *p == '\t' || *p == '\014')
|
||||
p++;
|
||||
res = PyUnicode_FromString(p);
|
||||
res = PyUnicode_FromString(linebuf);
|
||||
if (res == NULL)
|
||||
PyErr_Clear();
|
||||
return res;
|
||||
|
|
|
@ -528,7 +528,7 @@ print_error_text(PyObject *f, int offset, PyObject *text_obj)
|
|||
offset -= (int)(nl+1-text);
|
||||
text = nl+1;
|
||||
}
|
||||
while (*text == ' ' || *text == '\t') {
|
||||
while (*text == ' ' || *text == '\t' || *text == '\f') {
|
||||
text++;
|
||||
offset--;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue