Skip to content

Commit d492be2

Browse files
committed
use deepcopy in merge
1 parent 5f7521d commit d492be2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

SpiffWorkflow/util/deep_merge.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
1818
# 02110-1301 USA
1919

20+
from copy import deepcopy
21+
2022
class DeepMerge(object):
2123
# Merges two deeply nested json-like dictionaries,
2224
# useful for updating things like task data.
@@ -42,9 +44,9 @@ def merge(a, b, path=None):
4244
elif isinstance(a[key], list) and isinstance(b[key], list):
4345
DeepMerge.merge_array(a[key], b[key], path + [str(key)])
4446
else:
45-
a[key] = b[key] # Just overwrite the value in a.
47+
a[key] = deepcopy(b[key]) # Just overwrite the value in a.
4648
else:
47-
a[key] = b[key]
49+
a[key] = deepcopy(b[key])
4850
return a
4951

5052
@staticmethod

0 commit comments

Comments
 (0)