Skip to content

Commit 22843a0

Browse files
committed
Just reraise exceptions
1 parent 77e22e0 commit 22843a0

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/zarr/core/metadata/v2.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import base64
4-
import binascii
54
from collections.abc import Iterable
65
from enum import Enum
76
from typing import TYPE_CHECKING, cast
@@ -147,17 +146,8 @@ def from_dict(cls, data: dict[str, Any]) -> ArrayV2Metadata:
147146
if dtype.kind in "SV":
148147
fill_value_encoded = _data.get("fill_value")
149148
if fill_value_encoded is not None:
150-
if dtype.kind == "S":
151-
try:
152-
fill_value = base64.standard_b64decode(fill_value_encoded)
153-
_data["fill_value"] = fill_value
154-
except (TypeError, binascii.Error, ValueError):
155-
# be lenient, allow for other values that may have been used before base64
156-
# encoding and may work as fill values, e.g., the number 0
157-
pass
158-
elif dtype.kind == "V":
159-
fill_value = base64.standard_b64decode(fill_value_encoded)
160-
_data["fill_value"] = fill_value
149+
fill_value = base64.standard_b64decode(fill_value_encoded)
150+
_data["fill_value"] = fill_value
161151

162152
# zarr v2 allowed arbitrary keys here.
163153
# We don't want the ArrayV2Metadata constructor to fail just because someone put an

tests/v3/test_v2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import zarr
1010
import zarr.core.buffer.cpu
11+
import zarr.core.metadata
1112
import zarr.storage
1213
from zarr import Array
1314
from zarr.storage import MemoryStore, StorePath

0 commit comments

Comments
 (0)