Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0] silx.io.utils.h5py_read_dataset: Fixed support of empty arrays #4052

Merged
merged 2 commits into from
Jan 26, 2024
Merged
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
6 changes: 6 additions & 0 deletions src/silx/io/test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,12 @@ def _check_dataset(self, value, result=None):
if charset is not None:
assert self.file["vlen_data"].id.get_type().get_cset() == charset

self.file["vlen_empty_array"] = self._make_array(value, 0)
data = utils.h5py_read_dataset(
self.file["vlen_empty_array"], decode_ascii=decode_ascii
)
assert data.shape == (0,)

# Write+read fixed length
self.file["flen_data"] = self._make_array(value, 2, vlen=False)
data = utils.h5py_read_dataset(
Expand Down
5 changes: 4 additions & 1 deletion src/silx/io/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,10 @@ def h5py_value_isinstance(value, vtype):
except AttributeError:
pass
else:
value = value[0]
try:
value = value[0]
except IndexError:
pass
return isinstance(value, vtype)


Expand Down
Loading