[Python-checkins] r54288 - in python/trunk: Misc/NEWS Python/pythonrun.c

georg.brandl python-checkins at python.org
Mon Mar 12 15:30:21 CET 2007


Author: georg.brandl
Date: Mon Mar 12 15:30:05 2007
New Revision: 54288

Modified:
   python/trunk/Misc/NEWS
   python/trunk/Python/pythonrun.c
Log:
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.


Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Mon Mar 12 15:30:05 2007
@@ -12,6 +12,9 @@
 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__().

Modified: python/trunk/Python/pythonrun.c
==============================================================================
--- python/trunk/Python/pythonrun.c	(original)
+++ python/trunk/Python/pythonrun.c	Mon Mar 12 15:30:05 2007
@@ -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.


More information about the Python-checkins mailing list