From c718f8b72d0af30f3835125dc96a519029770077 Mon Sep 17 00:00:00 2001 From: TomekTrzeciak Date: Fri, 6 Dec 2024 19:23:01 +0000 Subject: [PATCH] preserve list subclass --- cylc/flow/parsec/util.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cylc/flow/parsec/util.py b/cylc/flow/parsec/util.py index 785612639a3..2bc2aeb36e0 100644 --- a/cylc/flow/parsec/util.py +++ b/cylc/flow/parsec/util.py @@ -212,7 +212,7 @@ def replicate(target, source): target[key].defaults_ = pdeepcopy(val.defaults_) replicate(target[key], val) elif isinstance(val, list): - target[key] = val[:] + target[key] = type(val)(val) else: target[key] = val @@ -247,7 +247,7 @@ def poverride(target, sparse, prepend=False): # Override in-place in the target ordered dict. setitem = target.__setitem__ if isinstance(val, list): - setitem(key, val[:]) + setitem(key, type(val)(val)) else: setitem(key, val) @@ -302,13 +302,9 @@ def m_override(target, sparse): "parsec dict override: no __MANY__ placeholder" + "%s" % (keylist + [key]) ) - if isinstance(val, list): - dest[key] = val[:] - else: - dest[key] = val if isinstance(val, list): - dest[key] = val[:] + dest[key] = type(val)(val) else: dest[key] = val for dest_dict, defaults in defaults_list: