Skip to content

Commit c82649f

Browse files
committed
fix blosc parsing from dict by ensuring that typesize is set on deserialization path
1 parent 4609d23 commit c82649f

File tree

1 file changed

+4
-3
lines changed
  • src/zarr/core/metadata

1 file changed

+4
-3
lines changed

src/zarr/core/metadata/v2.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ def _parse_codec(data: object, dtype: ZDType[Any, Any]) -> Codec | NumcodecWrapp
267267
"""
268268
Resolve a potential codec.
269269
"""
270+
271+
if _check_codecjson_v2(data) or _check_codecjson_v3(data):
272+
return _parse_codec(get_codec(data), dtype=dtype)
273+
270274
if isinstance(data, (Codec, NumcodecWrapper)):
271275
# TERRIBLE HACK
272276
# This is necessary because the Blosc codec defaults create a broken state.
@@ -292,9 +296,6 @@ def _parse_codec(data: object, dtype: ZDType[Any, Any]) -> Codec | NumcodecWrapp
292296
# in a NumcodecsWrapper
293297
return NumcodecWrapper(codec=data)
294298

295-
if _check_codecjson_v2(data) or _check_codecjson_v3(data):
296-
return get_codec(data)
297-
298299
raise TypeError(
299300
f"Invalid compressor. Expected None, a numcodecs.abc.Codec, or a dict representation of codec. Got {type(data)} instead."
300301
)

0 commit comments

Comments
 (0)