mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Patch #860326: traceback.format_exception_only() now prepends the
exception's module name to non-builtin exceptions, like the interpreter itself does.
This commit is contained in:
parent
64029986bc
commit
24c274f5dc
3 changed files with 30 additions and 1 deletions
|
@ -158,8 +158,12 @@ def format_exception_only(etype, value):
|
|||
"""
|
||||
list = []
|
||||
if (type(etype) == types.ClassType
|
||||
or (isinstance(etype, type) and issubclass(etype, Exception))):
|
||||
or (isinstance(etype, type) and issubclass(etype, BaseException))):
|
||||
stype = etype.__name__
|
||||
if not hasattr(etype, '__module__'):
|
||||
stype = '<unknown>.' + stype
|
||||
elif etype.__module__ != 'exceptions':
|
||||
stype = etype.__module__ + '.' + stype
|
||||
else:
|
||||
stype = etype
|
||||
if value is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue