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.
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 @@
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)