Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 454afe4..3a9e75e 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1226,8 +1226,8 @@
err = PyFile_WriteObject(s, f, Py_PRINT_RAW);
Py_XDECREF(s);
}
- if (err == 0)
- err = PyFile_WriteString("\n", f);
+ /* try to write a newline in any case */
+ err += PyFile_WriteString("\n", f);
}
Py_DECREF(value);
/* If an error happened here, don't show it.