Avoid deepcopying exception values

Since failure objects are by design meant to be
immutable we don't/shouldn't need to deepcopy
the exception value; so instead just do a shallow
copy and depend on the semantics that failure
objects are immutable to avoid any subsequent issues
here.

Change-Id: Id1f9ae04b330ab8c16ab2f7d1e877032639f1cb3
This commit is contained in:
Joshua Harlow
2014-11-28 15:03:34 -08:00
parent 707b47e798
commit e07fb21a1d

View File

@@ -25,13 +25,13 @@ from taskflow.utils import reflection
def _copy_exc_info(exc_info):
"""Make copy of exception info tuple, as deep as possible."""
if exc_info is None:
return None
exc_type, exc_value, tb = exc_info
# NOTE(imelnikov): there is no need to copy type, and
# we can't copy traceback.
return (exc_type, copy.deepcopy(exc_value), tb)
# NOTE(imelnikov): there is no need to copy the exception type, and
# a shallow copy of the value is fine and we can't copy the traceback since
# it contains reference to the internal stack frames...
return (exc_type, copy.copy(exc_value), tb)
def _are_equal_exc_info_tuples(ei1, ei2):