mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Bug #1531405, format_exception no longer raises an exception if
str(exception) raised an exception.
This commit is contained in:
parent
4b8bd31ef0
commit
ff4b63b80f
3 changed files with 51 additions and 5 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue