diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-04-19 16:02:36 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-04-19 16:02:36 (GMT) |
commit | 6d8d3b89fbcb22ca064a9d24f31f9a0b37e1826d (patch) | |
tree | f43f9d5fae1b2633d9686b3a05d0f1b74e1b21ef /src/engine/SCons | |
parent | 03eb2e5498807786834933b54703b3b9f127e282 (diff) | |
download | SCons-6d8d3b89fbcb22ca064a9d24f31f9a0b37e1826d.zip SCons-6d8d3b89fbcb22ca064a9d24f31f9a0b37e1826d.tar.gz SCons-6d8d3b89fbcb22ca064a9d24f31f9a0b37e1826d.tar.bz2 |
py2/3 fix logic for reraising exceptions. A taskmaster test was failing because the passed exception value wasn't an exception and thus couldn't be reraised as is. Added logic to create an exception with the value and raise that
Diffstat (limited to 'src/engine/SCons')
-rw-r--r-- | src/engine/SCons/Taskmaster.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index cf924e7..9bd9597 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -546,7 +546,13 @@ class Task(object): if sys.version_info[0] == 2: exec("raise exc_type, exc_value, exc_traceback") else: # sys.version_info[0] == 3: - exec("raise exc_value.with_traceback(exc_traceback)") + if isinstance(exc_value, Exception): #hasattr(exc_value, 'with_traceback'): + # If exc_value is an exception, then just reraise + exec("raise exc_value.with_traceback(exc_traceback)") + else: + # else we'll create an exception using the value and raise that + exec("raise exc_type(exc_value).with_traceback(exc_traceback)") + # raise e.__class__, e.__class__(e), sys.exc_info()[2] # exec("raise exc_type(exc_value).with_traceback(exc_traceback)") |