[python-hdf5storage] 13/84: Fixed bug where structured numpy.ndarrays with a field having an 'object' type is written as an HDF5 COMPOUND when the structured_numpy_ndarray_as_struct option is disabled. Is now written as a GROUP instead as if the option was set.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag 0.1.10
in repository python-hdf5storage.

commit d6c1a7d566b617160ec5ed2d54c52169bbfa8cb2
Author: Freja Nordsiek <fnordsie at gmail.com>
Date:   Thu Aug 14 16:05:37 2014 -0400

    Fixed bug where structured numpy.ndarrays with a field having an 'object' type is written as an HDF5 COMPOUND when the structured_numpy_ndarray_as_struct option is disabled. Is now written as a GROUP instead as if the option was set.
---
 hdf5storage/Marshallers.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hdf5storage/Marshallers.py b/hdf5storage/Marshallers.py
index 44a3c36..b3fafa3 100644
--- a/hdf5storage/Marshallers.py
+++ b/hdf5storage/Marshallers.py
@@ -656,13 +656,18 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
         # look like a structured object array, those have to be excluded
         # explicitly. Complex types may have been converted so that they
         # can have different field names as an HDF5 COMPOUND type, so
-        # those have to be escluded too.
+        # those have to be excluded too. Also, if any of its fields are
+        # an object time (no matter how nested), then rather than
+        # converting that field to a HDF5 Reference types, it will just
+        # be written as a Group instead (just have to see if "'O'" is in
+        # str(data_to_store.dtype).
 
         if data_to_store.dtype.fields is not None \
                 and h5py.check_dtype(ref=data_to_store.dtype) \
                 is not h5py.Reference \
                 and not np.iscomplexobj(data) \
-                and options.structured_numpy_ndarray_as_struct:
+                and (options.structured_numpy_ndarray_as_struct
+                or "'O'" in str(data_to_store.dtype)):
             # If the group doesn't exist, it needs to be created. If it
             # already exists but is not a group, it needs to be deleted
             # before being created.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-hdf5storage.git



More information about the debian-science-commits mailing list