summaryrefslogtreecommitdiffstats
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-04-12 21:14:09 (GMT)
committerGeorg Brandl <georg@python.org>2006-04-12 21:14:09 (GMT)
commit24c274f5dc2f2f9ebe6d3c9ee087b80d40bd49b4 (patch)
tree6d2142f4321d52c38345cc5f32876fa91ac0ea97 /Lib/traceback.py
parent64029986bc8b7c7eac7bc6f6265d3d3163d8bb06 (diff)
downloadcpython-24c274f5dc2f2f9ebe6d3c9ee087b80d40bd49b4.zip
cpython-24c274f5dc2f2f9ebe6d3c9ee087b80d40bd49b4.tar.gz
cpython-24c274f5dc2f2f9ebe6d3c9ee087b80d40bd49b4.tar.bz2
Patch #860326: traceback.format_exception_only() now prepends the
exception's module name to non-builtin exceptions, like the interpreter itself does.
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 454eb1b..56a87dc 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -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: