Skip to content

Commit 315e22e

Browse files
committed
Raise not implemented error on pickling
1 parent 26fa37e commit 315e22e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/zarr/storage/object_store.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ def __str__(self) -> str:
6969
def __repr__(self) -> str:
7070
return f"ObjectStore({self})"
7171

72+
def __getstate__(self) -> None:
73+
raise NotImplementedError("Pickling has not been implement for ObjectStore")
74+
75+
def __setstate__(self) -> None:
76+
raise NotImplementedError("Pickling has not been implement for ObjectStore")
77+
7278
async def get(
7379
self, key: str, prototype: BufferPrototype, byte_range: ByteRequest | None = None
7480
) -> Buffer:

tests/test_store/test_object.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
obstore = pytest.importorskip("obstore")
55

6+
import pickle
67
import re
78

89
from zarr.core.buffer import Buffer, cpu
@@ -51,3 +52,8 @@ def test_store_supports_partial_writes(self, store: ObjectStore) -> None:
5152

5253
def test_store_supports_listing(self, store: ObjectStore) -> None:
5354
assert store.supports_listing
55+
56+
@pytest.mark.xfail(reason="Not Implemented")
57+
def test_serializable_store(self, store: ObjectStore) -> None:
58+
foo = pickle.dumps(store)
59+
assert pickle.loads(foo) == store

0 commit comments

Comments
 (0)