Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 1898:20f17b5accbf legacy-trunk
* Python/pythonrun.c (print_error): print only last line of
multi-line source line
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 19 Sep 1994 08:08:50 +0000 |
| parents | ac6a9f90f6fd |
| children | a7f269610ec2 |
line wrap: on
line diff
--- a/Python/pythonrun.c Mon Sep 19 08:06:25 1994 +0000 +++ b/Python/pythonrun.c Mon Sep 19 08:08:50 1994 +0000 @@ -286,6 +286,18 @@ writestring(buf, f); writestring("\n", f); if (text != NULL) { + char *nl; + if (offset > 0 && + offset == strlen(text)) + offset--; + for (;;) { + nl = strchr(text, '\n'); + if (nl == NULL || + nl-text >= offset) + break; + offset -= (nl+1-text); + text = nl+1; + } while (*text == ' ' || *text == '\t') { text++; offset--;
