summaryrefslogtreecommitdiffstats
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-11-28 16:16:09 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-11-28 16:16:09 (GMT)
commitbcc63a86a943b03e7472109cbf6d7f962f6b0b5a (patch)
treec4d72e31f48fd3708ed6f133bcebb85b5ecda2ef /Lib/traceback.py
parent875ada4b0fefd2e399719d728073b681a04d31b4 (diff)
downloadcpython-bcc63a86a943b03e7472109cbf6d7f962f6b0b5a.zip
cpython-bcc63a86a943b03e7472109cbf6d7f962f6b0b5a.tar.gz
cpython-bcc63a86a943b03e7472109cbf6d7f962f6b0b5a.tar.bz2
Merged revisions 76573 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r76573 | antoine.pitrou | 2009-11-28 17:12:28 +0100 (sam., 28 nov. 2009) | 3 lines Issue #4486: When an exception has an explicit cause, do not print its implicit context too. ........
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index c0d8061..8d4e96e 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -120,13 +120,14 @@ def _iter_chain(exc, custom_tb=None, seen=None):
seen.add(exc)
its = []
cause = exc.__cause__
- context = exc.__context__
if cause is not None and cause not in seen:
its.append(_iter_chain(cause, None, seen))
its.append([(_cause_message, None)])
- if context is not None and context is not cause and context not in seen:
- its.append(_iter_chain(context, None, seen))
- its.append([(_context_message, None)])
+ else:
+ context = exc.__context__
+ if context is not None and context not in seen:
+ its.append(_iter_chain(context, None, seen))
+ its.append([(_context_message, None)])
its.append([(exc, custom_tb or exc.__traceback__)])
# itertools.chain is in an extension module and may be unavailable
for it in its: