Closed FrancescAlted closed 3 years ago
This patch will fix it:
diff --git a/iarray/iarray_ext.pyx b/iarray/iarray_ext.pyx
index 4da3c20..19b3ae8 100644
--- a/iarray/iarray_ext.pyx
+++ b/iarray/iarray_ext.pyx
@@ -26,6 +26,8 @@ from cpython cimport (
PyBUF_SIMPLE, PyBUF_WRITABLE, Py_buffer,
PyBytes_FromStringAndSize
)
+from dataclasses import asdict
+
def compress_squeeze(data, selectors):
return tuple(d for d, s in zip(data, selectors) if not s)
@@ -685,7 +687,12 @@ def get_slice(ctx, data, start, stop, squeeze_mask, view, storage):
cdef ciarray.iarray_storage_t store_
cdef ciarray.iarray_container_t *c
- cfg = ctx.cfg
+
+ # A deep copy of the cfg is needed, but can not be used copy.deepcopy().
+ kwargs = asdict(ctx.cfg)
+ kwargs["store"] = ia.Store(**kwargs["store"])
+ cfg = ia.Config(**kwargs)
+
if view:
if cfg.blocks and cfg.chunks:
shape = tuple(sp - st for sp, st in zip(stop, start))
But I think we need to check why get_slice
and set_slice
in .pyx
file use a ctx
instead of a cfg
.
The next script shows the behaviour: