Issue #25677: Merge SyntaxError caret positioning from 3.6

This commit is contained in:
Martin Panter 2016-12-19 06:46:12 +00:00
commit b46edf35f3
5 changed files with 39 additions and 5 deletions

View file

@ -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;

View file

@ -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--;
}