summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_traceback.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-09-24 12:50:24 (GMT)
committerGeorg Brandl <georg@python.org>2006-09-24 12:50:24 (GMT)
commitc7986cee76cf2ffd6f8351fa8a65ce658825f70a (patch)
treeb452376236b5c4464478e85c707445160a19fc38 /Lib/test/test_traceback.py
parenta10d3afed2f27504768dffd3a915a7c876258505 (diff)
downloadcpython-c7986cee76cf2ffd6f8351fa8a65ce658825f70a.zip
cpython-c7986cee76cf2ffd6f8351fa8a65ce658825f70a.tar.gz
cpython-c7986cee76cf2ffd6f8351fa8a65ce658825f70a.tar.bz2
Fix a bug in traceback.format_exception_only() that led to an error
being raised when print_exc() was called without an exception set. In version 2.4, this printed "None", restored that behavior.
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r--Lib/test/test_traceback.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index b3c5a50..b42dbc4 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -149,6 +149,10 @@ def test():
str_value = '<unprintable %s object>' % X.__name__
self.assertEqual(err[0], X.__name__ + ': ' + str_value + '\n')
+ def test_without_exception(self):
+ err = traceback.format_exception_only(None, None)
+ self.assertEqual(err, ['None\n'])
+
def test_main():
run_unittest(TracebackCases)