comparison Python/pythonrun.c @ 65695:64cee8d11f2e 2.7

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) ........
author Benjamin Peterson <benjamin@python.org>
date Fri, 29 Oct 2010 03:45:34 +0000
parents a4a27240fe09
children b36cb4602e21
comparison
equal deleted inserted replaced
65684:5383ae8db3cd 65695:64cee8d11f2e
1043 static void 1043 static void
1044 print_error_text(PyObject *f, int offset, const char *text) 1044 print_error_text(PyObject *f, int offset, const char *text)
1045 { 1045 {
1046 char *nl; 1046 char *nl;
1047 if (offset >= 0) { 1047 if (offset >= 0) {
1048 if (offset > 0 && offset == strlen(text) && text[offset - 1] == '\n')
1049 offset--;
1048 for (;;) { 1050 for (;;) {
1049 nl = strchr(text, '\n'); 1051 nl = strchr(text, '\n');
1050 if (nl == NULL || nl-text >= offset) 1052 if (nl == NULL || nl-text >= offset)
1051 break; 1053 break;
1052 offset -= (int)(nl+1-text); 1054 offset -= (int)(nl+1-text);