Close issue #6210: Implement PEP 409

This commit is contained in:
Nick Coghlan 2012-02-26 17:49:52 +10:00
parent cda6b6d60d
commit ab7bf2143e
15 changed files with 263 additions and 42 deletions

View file

@ -120,14 +120,14 @@ def _iter_chain(exc, custom_tb=None, seen=None):
seen.add(exc)
its = []
cause = exc.__cause__
if cause is not None and cause not in seen:
its.append(_iter_chain(cause, None, seen))
its.append([(_cause_message, None)])
else:
if cause is Ellipsis:
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)])
elif cause is not None and cause not in seen:
its.append(_iter_chain(cause, False, seen))
its.append([(_cause_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: