Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions changes/4029.bugfix.md

This file was deleted.

1 change: 1 addition & 0 deletions changes/4505.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `zarr.storage` module can now be serialized with `cloudpickle`. Previously, code that referenced the module (for example a Dask task that used `zarr.storage.ObjectStore`) failed with `TypeError: cannot pickle 'VerboseModule' object`.
1 change: 1 addition & 0 deletions changes/4505.removal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Setting `zarr.storage.default_compressor` no longer emits a deprecation warning. The attribute has had no effect since 3.0.0; configure `array.v2_default_compressor` through `zarr.config` instead.
13 changes: 6 additions & 7 deletions tests/test_store/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,11 @@ def test_different_open_mode(tmp_path: Path) -> None:


def test_storage_module_is_picklable() -> None:
# `zarr.storage` used to be swapped for a `VerboseModule` subclass of
# `types.ModuleType` in order to warn about the long-deprecated
# `zarr.storage.default_compressor` attribute. cloudpickle dispatches on the
# exact type of an object, so the subclass was not registered and
# serializing the module raised `TypeError: cannot pickle 'VerboseModule'
# object`, which broke passing `zarr.storage.ObjectStore` around with Dask.
# See issue #4029.
"""
`zarr.storage` is a plain `types.ModuleType` and round-trips through `cloudpickle`.

Serializers such as `cloudpickle` dispatch on the exact type of an object, so a
`ModuleType` subclass would not be serializable. See issue #4029.
"""
assert type(zarr.storage) is ModuleType
assert cloudpickle.loads(cloudpickle.dumps(zarr.storage)) is zarr.storage
Loading