Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 65694:6ac18576e8fa
decrement offset when it points to a newline (#10186 followup)
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Fri, 29 Oct 2010 03:28:14 +0000 |
| parents | f148f864b168 |
| children | ea14977a36de |
line wrap: on
line diff
--- a/Python/pythonrun.c Fri Oct 29 00:57:35 2010 +0000 +++ b/Python/pythonrun.c Fri Oct 29 03:28:14 2010 +0000 @@ -1344,6 +1344,8 @@ { 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) @@ -1363,7 +1365,7 @@ if (offset == -1) return; PyFile_WriteString(" ", f); - while (--offset) + while (--offset > 0) PyFile_WriteString(" ", f); PyFile_WriteString("^\n", f); }
