Mercurial > hg
comparison mercurial/localrepo.py @ 37669:1cb54e6193a6
py3: paper over differences in future exception handling
It looks like Python 3's futures library lacks set_exception_info
entirely. We'll just give up and use set_exception in that case.
# no-check-commit because the underbar naming is just saner here
Differential Revision: https://phab.mercurial-scm.org/D3336
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 13 Apr 2018 18:17:45 -0400 |
parents | 62ebfda864de |
children | 719b8cb22936 |
comparison
equal
deleted
inserted
replaced
37668:2a42ca2679e2 | 37669:1cb54e6193a6 |
---|---|
182 f = pycompat.futures.Future() | 182 f = pycompat.futures.Future() |
183 | 183 |
184 try: | 184 try: |
185 result = fn(**args) | 185 result = fn(**args) |
186 except Exception: | 186 except Exception: |
187 f.set_exception_info(*sys.exc_info()[1:]) | 187 pycompat.future_set_exception_info(f, sys.exc_info()[1:]) |
188 else: | 188 else: |
189 f.set_result(result) | 189 f.set_result(result) |
190 | 190 |
191 return f | 191 return f |
192 | 192 |