Skip to content

Commit 3ca9f36

Browse files
committed
Potential fix for h5py deepcopy issues
1 parent 66ab0ae commit 3ca9f36

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

xarray/core/indexing.py

+6
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,12 @@ def __setitem__(self, key, value):
664664
self._ensure_copied()
665665
self.array[key] = value
666666

667+
def __deepcopy__(self, memo):
668+
# CopyOnWriteArray is used to wrap backend array objects, which might
669+
# point to files on disk, so we can't rely on the default deepcopy
670+
# implementation.
671+
return type(self)(self.array)
672+
667673

668674
class MemoryCachedArray(ExplicitlyIndexedNDArrayMixin):
669675
__slots__ = ("array",)

0 commit comments

Comments
 (0)