util: raise with traceback in Python 2

Summary: Similar to D23819023 (c96de76ac0) but works on Python 2, too.

Reviewed By: DurhamG

Differential Revision: D23858273

fbshipit-source-id: b15be07c8657bc8cb37960b631f2b31e4a78892b
This commit is contained in:
Jun Wu 2020-09-23 12:35:54 -07:00 committed by Facebook GitHub Bot
parent f7ea4e2747
commit 2f5752eda5

View File

@ -4357,6 +4357,9 @@ def threaded(func):
variant, value = result variant, value = result
if variant == "err": if variant == "err":
tb = getattr(value, "__traceback__", None)
if tb is not None:
pycompat.raisewithtb(value, tb)
raise value raise value
return value return value