]> granicus.if.org Git - python/commitdiff
mwh: [ Patch #103228 ] traceback.py nit.
authorGuido van Rossum <guido@python.org>
Sat, 13 Jan 2001 22:14:31 +0000 (22:14 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 13 Jan 2001 22:14:31 +0000 (22:14 +0000)
When the exception has no message, don't insert a colon after the
exception name.

Lib/traceback.py

index b733598f258476b34721d8b99a133e7d28a65eb0..064712e6c220f14372ca177b272c70bd0555f8ef 100644 (file)
@@ -166,7 +166,11 @@ def format_exception_only(etype, value):
                                                s = s + ' '
                                list.append('%s^\n' % s)
                                value = msg
-               list.append('%s: %s\n' % (str(stype), _some_str(value)))
+               s = _some_str(value)
+               if s:
+                       list.append('%s: %s\n' % (str(stype), s))
+               else:
+                       list.append('%s\n' % str(stype))
        return list
 
 def _some_str(value):