Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 65696:e8c8400caa99 3.1
Merged revisions 85817,85904 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85817 | benjamin.peterson | 2010-10-23 22:41:46 -0500 (Sat, 23 Oct 2010) | 1 line
tighten loop
........
r85904 | benjamin.peterson | 2010-10-28 22:28:14 -0500 (Thu, 28 Oct 2010) | 1 line
decrement offset when it points to a newline (#10186 followup)
........
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Fri, 29 Oct 2010 04:02:30 +0000 |
| parents | 53639e57ba40 |
| children | b03779f00739 |
line wrap: on
line diff
--- a/Python/pythonrun.c Thu Oct 28 23:06:57 2010 +0000 +++ b/Python/pythonrun.c Fri Oct 29 04:02:30 2010 +0000 @@ -1299,6 +1299,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) @@ -1318,11 +1320,8 @@ if (offset == -1) return; PyFile_WriteString(" ", f); - offset--; - while (offset > 0) { + while (--offset > 0) PyFile_WriteString(" ", f); - offset--; - } PyFile_WriteString("^\n", f); }
