Skip to content

Commit 9e90a02

Browse files
authored
Merge pull request #9 from maxrjones/fix-serialization
2 parents 4d15e43 + 9a25057 commit 9e90a02

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/zarr/storage/_object.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,12 @@ def __repr__(self) -> str:
142142
return f"ObjectStore({self})"
143143

144144
def __getstate__(self) -> dict[Any, Any]:
145-
self.__dict__.update({"store": pickle.dumps(self.store)})
146-
return self.__dict__.copy()
145+
state = self.__dict__.copy()
146+
state["store"] = pickle.dumps(self.store)
147+
return state
147148

148149
def __setstate__(self, state: dict[Any, Any]) -> None:
150+
state["store"] = pickle.loads(state["store"])
149151
self.__dict__.update(state)
150152

151153
async def get(

0 commit comments

Comments
 (0)