Skip to content

Commit

Permalink
Potential fix for h5py deepcopy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shoyer committed Sep 16, 2020
1 parent 66ab0ae commit 3ca9f36
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xarray/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,12 @@ def __setitem__(self, key, value):
self._ensure_copied()
self.array[key] = value

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


class MemoryCachedArray(ExplicitlyIndexedNDArrayMixin):
__slots__ = ("array",)
Expand Down

0 comments on commit 3ca9f36

Please sign in to comment.