diff --git a/zarr/_storage/store.py b/zarr/_storage/store.py index 2c0ad707f6..fcef80033f 100644 --- a/zarr/_storage/store.py +++ b/zarr/_storage/store.py @@ -196,7 +196,7 @@ def _valid_key(self, key: str) -> bool: 0-9, or in the set /.-_ it will return True if that's the case, False otherwise. """ - if not isinstance(key, str) or not key.isascii(): + if not isinstance(key, str) or not key.isascii(): # type: ignore[redundant-expr] return False if set(key) - self._valid_key_characters: return False diff --git a/zarr/storage.py b/zarr/storage.py index e6ba7107f0..a508231389 100644 --- a/zarr/storage.py +++ b/zarr/storage.py @@ -2501,6 +2501,8 @@ def _accommodate_value(self, value_size): self._current_size -= buffer_size(v) def _cache_value(self, key: Path, value): + if self._max_size is None: + return # cache a value value_size = buffer_size(value) # check size of the value against max size, as if the value itself exceeds max