Skip to content

Commit

Permalink
Update _iter_chain to the latest code in Python 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
felixonmars committed Nov 8, 2015
1 parent a58b3e8 commit 45b26f3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/zope/testrunner/tb_format.py
Expand Up @@ -29,15 +29,16 @@ def _iter_chain(exc, custom_tb=None, seen=None):
seen = set()
seen.add(exc)
its = []
context = exc.__context__
cause = exc.__cause__
if cause is not None and cause not in seen:
its.append(_iter_chain(cause, None, seen))
its.append(_iter_chain(cause, False, seen))
its.append([(traceback._cause_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([(traceback._context_message, None)])
elif (context is not None and
not exc.__suppress_context__ and
context not in seen):
its.append(_iter_chain(context, None, seen))
its.append([(traceback._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:
Expand Down

0 comments on commit 45b26f3

Please sign in to comment.