diff options
Diffstat (limited to 'Python/pythonrun.c')
| -rw-r--r-- | Python/pythonrun.c | 7 | 
1 files changed, 3 insertions, 4 deletions
| diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 10a1d504a0..3dbe754d26 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1299,6 +1299,8 @@ print_error_text(PyObject *f, int offset, const char *text)  {      char *nl;      if (offset >= 0) { +        if (offset > 0 && offset == strlen(text) && text[offset - 1] == '\n') +            offset--;          for (;;) {              nl = strchr(text, '\n');              if (nl == NULL || nl-text >= offset) @@ -1318,11 +1320,8 @@ print_error_text(PyObject *f, int offset, const char *text)      if (offset == -1)          return;      PyFile_WriteString("    ", f); -    offset--; -    while (offset > 0) { +    while (--offset > 0)          PyFile_WriteString(" ", f); -        offset--; -    }      PyFile_WriteString("^\n", f);  } | 
