Handle absence of __context__ and __cause__ on < 3.x

This commit is contained in:
Robert Collins 2014-11-21 13:42:19 +13:00
parent 5ac32f61d7
commit 5ec8d62e4b
1 changed files with 2 additions and 2 deletions

View File

@ -122,8 +122,8 @@ def _iter_chain(exc, custom_tb=None, seen=None):
seen = set()
seen.add(exc)
its = []
context = exc.__context__
cause = exc.__cause__
context = getattr(exc, '__context__', None)
cause = getattr(exc, '__cause__', None)
if cause is not None and cause not in seen:
its.append(_iter_chain(cause, False, seen))
its.append([(_cause_message, None)])