From e07fb21a1dda9e6c6698e4235064d405b06dec9d Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 28 Nov 2014 15:03:34 -0800 Subject: [PATCH] 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 --- taskflow/types/failure.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/taskflow/types/failure.py b/taskflow/types/failure.py index c905277c..0f7f3d2c 100644 --- a/taskflow/types/failure.py +++ b/taskflow/types/failure.py @@ -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):