diff --git a/Lib/traceback.py b/Lib/traceback.py index 505a3052ccf..75e1fcffa38 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -202,15 +202,11 @@ def format_exception_only(etype, value): 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):