From 4a74bf062e81ca48c6a73c045585b22b2a87883e Mon Sep 17 00:00:00 2001 From: Francesc Alted Date: Fri, 27 Dec 2024 13:51:46 +0100 Subject: [PATCH] Fix cparams overriding code --- src/blosc2/lazyexpr.py | 10 +++++++--- src/blosc2/ndarray.py | 4 ---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/blosc2/lazyexpr.py b/src/blosc2/lazyexpr.py index e7cbc6f7..f0f70e8c 100644 --- a/src/blosc2/lazyexpr.py +++ b/src/blosc2/lazyexpr.py @@ -2627,12 +2627,16 @@ def compute(self, item=None, **kwargs): # Do copy to avoid modifying the original parameters aux_kwargs = copy.deepcopy(self.kwargs) # Update is not recursive - cparams = aux_kwargs.get("cparams", {}) + aux_cparams = aux_kwargs.get("cparams", {}) + if isinstance(aux_cparams, blosc2.CParams): + # Convert to dictionary + aux_cparams = asdict(aux_cparams) + cparams = kwargs.get("cparams", {}) if isinstance(cparams, blosc2.CParams): # Convert to dictionary cparams = asdict(cparams) - cparams.update(kwargs.get("cparams", {})) - aux_kwargs["cparams"] = cparams + aux_cparams.update(cparams) + aux_kwargs["cparams"] = aux_cparams dparams = aux_kwargs.get("dparams", {}) if isinstance(dparams, blosc2.DParams): # Convert to dictionary diff --git a/src/blosc2/ndarray.py b/src/blosc2/ndarray.py index cf41683c..7b20d829 100644 --- a/src/blosc2/ndarray.py +++ b/src/blosc2/ndarray.py @@ -3185,10 +3185,6 @@ def linspace_fill(inputs, output, offset): # C order is guaranteed, and no reshape is needed return lazyarr.compute(**kwargs) - if len(shape) == 1: - # C order is guaranteed, and no reshape is needed - return lazyarr.compute(**kwargs) - # In principle, when c_order is False, the intermediate array wouldn't be needed, # but this is faster; see arange() for more details. larr = lazyarr.compute() # intermediate array