diff options
author | Guido van Rossum <guido@python.org> | 1994-09-19 08:08:50 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-09-19 08:08:50 +0000 |
commit | a853569f917fcf5cecf33b12a45a0c7d1f641bd5 (patch) | |
tree | 2b18f4d7c0dae10186d4df313f845c653ca829dc /Python/pythonrun.c | |
parent | eface847027eda63b5564d68a2e40f0aff7f4288 (diff) | |
download | cpython-a853569f917fcf5cecf33b12a45a0c7d1f641bd5.tar.gz |
* Python/pythonrun.c (print_error): print only last line of
multi-line source line
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index e547f9238a..978e4b866b 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -286,6 +286,18 @@ print_error() 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--; |