summaryrefslogtreecommitdiffstats
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-04 04:50:21 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-04 04:50:21 (GMT)
commitff4b63b80f36fdeac1338f32ec2c4eb689b78e49 (patch)
tree3a44c046e02bf8a9f08aa68b45b943aaf5d5e345 /Lib/traceback.py
parent4b8bd31ef0d77990caa11a58938dae9f52b65ebd (diff)
downloadcpython-ff4b63b80f36fdeac1338f32ec2c4eb689b78e49.zip
cpython-ff4b63b80f36fdeac1338f32ec2c4eb689b78e49.tar.gz
cpython-ff4b63b80f36fdeac1338f32ec2c4eb689b78e49.tar.bz2
Bug #1531405, format_exception no longer raises an exception if
str(exception) raised an exception.
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index a0b5759..505a305 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -202,7 +202,12 @@ 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"""
- if value is None or not str(value):
+ try:
+ printable = value is None or not str(value)
+ except:
+ printable = False
+
+ if printable:
line = "%s\n" % etype
else:
line = "%s: %s\n" % (etype, _some_str(value))