Skip to content
Merged
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
10 changes: 9 additions & 1 deletion zarr/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,15 @@ def __getitem__(self, key):
if doc is None:
raise KeyError(key)
else:
return binary_type(doc[self._value])
value = doc[self._value]

# Coerce `bson.Binary` to `bytes` type on Python 2.
# PyMongo handles this conversion for us on Python 3.
# ref: http://api.mongodb.com/python/current/python3.html#id3
if PY2: # pragma: py3 no cover
value = binary_type(value)

return value

def __setitem__(self, key, value):
value = ensure_bytes(value)
Expand Down