Merged revisions 85904 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  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)
........
This commit is contained in:
Benjamin Peterson 2010-10-29 03:45:34 +00:00
parent 638cee62d5
commit ec9f9f535a
1 changed files with 2 additions and 0 deletions

View File

@ -1045,6 +1045,8 @@ print_error_text(PyObject *f, int offset, const char *text)
{ {
char *nl; char *nl;
if (offset >= 0) { if (offset >= 0) {
if (offset > 0 && offset == strlen(text) && text[offset - 1] == '\n')
offset--;
for (;;) { for (;;) {
nl = strchr(text, '\n'); nl = strchr(text, '\n');
if (nl == NULL || nl-text >= offset) if (nl == NULL || nl-text >= offset)