[Python-checkins] r51111 - python/trunk/Lib/traceback.py

georg.brandl python-checkins at python.org
Fri Aug 4 20:07:34 CEST 2006


Author: georg.brandl
Date: Fri Aug  4 20:07:34 2006
New Revision: 51111

Modified:
   python/trunk/Lib/traceback.py
Log:
Better fix for bug #1531405, not executing str(value) twice.



Modified: python/trunk/Lib/traceback.py
==============================================================================
--- python/trunk/Lib/traceback.py	(original)
+++ python/trunk/Lib/traceback.py	Fri Aug  4 20:07:34 2006
@@ -202,15 +202,11 @@
 
 def _format_final_exc_line(etype, value):
     """Return a list of a single line -- normal case for format_exception_only"""
-    try:
-        printable = value is None or not str(value)
-    except:
-        printable = False
-
-    if printable:
+    valuestr = _some_str(value)
+    if value is None or not valuestr:
         line = "%s\n" % etype
     else:
-        line = "%s: %s\n" % (etype, _some_str(value))
+        line = "%s: %s\n" % (etype, valuestr)
     return line
 
 def _some_str(value):


More information about the Python-checkins mailing list