diff --git a/src/gt4py/cartesian/gtc/dace/nodes.py b/src/gt4py/cartesian/gtc/dace/nodes.py index 42221d75c0..926265b2c7 100644 --- a/src/gt4py/cartesian/gtc/dace/nodes.py +++ b/src/gt4py/cartesian/gtc/dace/nodes.py @@ -50,9 +50,17 @@ def to_json(self, obj): @classmethod def from_json(cls, d, sdfg=None): - b64string = d["pickle"] - byte_repr = base64.b64decode(b64string) - return pickle.loads(byte_repr) + # DaCe won't serialize attr with default values by default + # which would lead the deserializer to push a default in the + # wrong format (non pickle). + # Best mitigation is to give back the object plain if it does + # not contain any pickling information + if isinstance(d, dict) and "pickle" in d.keys(): + b64string = d["pickle"] + byte_repr = base64.b64decode(b64string) + return pickle.loads(byte_repr) + + return d class PickledDataclassProperty(PickledProperty, dace.properties.DataclassProperty): diff --git a/tests/cartesian_tests/integration_tests/multi_feature_tests/test_dace_parsing.py b/tests/cartesian_tests/integration_tests/multi_feature_tests/test_dace_parsing.py index 7a793c0a70..9fafc27c85 100644 --- a/tests/cartesian_tests/integration_tests/multi_feature_tests/test_dace_parsing.py +++ b/tests/cartesian_tests/integration_tests/multi_feature_tests/test_dace_parsing.py @@ -46,8 +46,6 @@ def dace_env(): dace.config.Config.set("compiler", "cpu", "args", value="") dace.config.Config.set("compiler", "allow_view_arguments", value=True) dace.config.Config.set("default_build_folder", value=str(gt_cache_path)) - # Need to serialize `StencilComputation` library nodes because they contain OIR for `VerticalLoop` - dace.config.Config.set("testing", "serialize_all_fields", value=True) yield