summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index f3b4e50..87ffb39 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1045,6 +1045,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)