Mercurial > cpython-lru_cache-weakref
diff Lib/traceback.py @ 57498:4bed796ee0d7 3.1
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.
........
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sat, 28 Nov 2009 16:16:09 +0000 |
| parents | fa91270b6087 |
| children | b299c4f31ff2 |
line wrap: on
line diff
--- a/Lib/traceback.py Sat Nov 28 12:52:39 2009 +0000 +++ b/Lib/traceback.py Sat Nov 28 16:16:09 2009 +0000 @@ -120,13 +120,14 @@ 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:
