diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-10-29 04:02:30 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-10-29 04:02:30 (GMT) |
commit | c8850d0771192357b384b93efb4b0c8d0650471d (patch) | |
tree | 2345e4faf8fe5ea0049493cf993535a8ecdc2689 /Python/pythonrun.c | |
parent | 98e2b452975f13b13052aeb9d166ed8a3ef45063 (diff) | |
download | cpython-c8850d0771192357b384b93efb4b0c8d0650471d.zip cpython-c8850d0771192357b384b93efb4b0c8d0650471d.tar.gz cpython-c8850d0771192357b384b93efb4b0c8d0650471d.tar.bz2 |
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)
........
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 10a1d50..3dbe754 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); } |