mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
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.
This commit is contained in:
parent
a10d3afed2
commit
c7986cee76
3 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue