Issue #25677: Correct syntax error caret for indented blocks.

Based on patch by Michael Layzell.
This commit is contained in:
Martin Panter 2016-12-11 00:18:36 +00:00
parent b94eef2ae3
commit ca3263c50c
5 changed files with 39 additions and 5 deletions

View file

@ -1094,11 +1094,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--;
}