]> granicus.if.org Git - python/commitdiff
Bug #1678647: write a newline after printing an exception in any
authorGeorg Brandl <georg@python.org>
Mon, 12 Mar 2007 14:30:05 +0000 (14:30 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 12 Mar 2007 14:30:05 +0000 (14:30 +0000)
case, even when converting the value to a string failed.

Misc/NEWS
Python/pythonrun.c

index 2ac04c9f39a0d2ae770282aea229a7f9399ed5fd..67f417a2b4efbc5fa3d77de64f98e79c75084a53 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
 Core and builtins
 -----------------
 
+- Bug #1678647: write a newline after printing an exception in any
+  case, even when converting the value to a string failed.
+
 - The dir() function has been extended to call the __dir__() method on
   its argument, if it exists. If not, it will work like before. This allows
   customizing the output of dir() in the presence of a __getattr__().
index 454afe47f78d66f2d1302c558355f432201dd93f..3a9e75e2373adf87f28f7edbc32ab8e059704c2c 100644 (file)
@@ -1226,8 +1226,8 @@ PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
                          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.