[h5py] 218/455: Disable creation of ARRAY datasets. I'm not going to fix this.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:34 UTC 2015


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

ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.

commit f545a45dfee0a65f5638b8f06997de91322f5222
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Wed Feb 4 23:00:48 2009 +0000

    Disable creation of ARRAY datasets.  I'm not going to fix this.
---
 h5py/h5d.pyx      | 18 ++++++++++--------
 h5py/highlevel.py |  3 +++
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/h5py/h5d.pyx b/h5py/h5d.pyx
index 5ee35e1..a651cb4 100644
--- a/h5py/h5d.pyx
+++ b/h5py/h5d.pyx
@@ -159,9 +159,10 @@ cdef class DatasetID(ObjectID):
 
     @sync
     def read(self, SpaceID mspace not None, SpaceID fspace not None, 
-                   ndarray arr_obj not None, PropID dxpl=None):
+                   ndarray arr_obj not None, TypeID mtype=None,
+                   PropID dxpl=None):
         """ (SpaceID mspace, SpaceID fspace, NDARRAY arr_obj, 
-             PropDXID dxpl=None)
+             TypeID mtype=None, PropDXID dxpl=None)
 
             Read data from an HDF5 dataset into a Numpy array.  For maximum 
             flexibility, you can specify dataspaces for the file and the Numpy
@@ -182,12 +183,12 @@ cdef class DatasetID(ObjectID):
             is a bad idea.  All HDF5 API calls are locked until the read
             completes.
         """
-        cdef TypeID mtype
         cdef hid_t self_id, mtype_id, mspace_id, fspace_id, plist_id
         cdef void* data
         cdef int oldflags
 
-        mtype = py_create(arr_obj.dtype)
+        if mtype is None:
+            mtype = py_create(arr_obj.dtype)
         check_numpy_write(arr_obj, -1)
 
         self_id = self.id
@@ -206,9 +207,10 @@ cdef class DatasetID(ObjectID):
 
     @sync
     def write(self, SpaceID mspace not None, SpaceID fspace not None, 
-                    ndarray arr_obj not None, PropID dxpl=None):
+                    ndarray arr_obj not None, TypeID mtype=None,
+                    PropID dxpl=None):
         """ (SpaceID mspace, SpaceID fspace, NDARRAY arr_obj, 
-             PropDXID dxpl=None)
+             TypeID mtype=None, PropDXID dxpl=None)
 
             Write data from a Numpy array to an HDF5 dataset. Keyword dxpl may 
             be a dataset transfer property list.
@@ -221,12 +223,12 @@ cdef class DatasetID(ObjectID):
             is a bad idea.  All HDF5 API calls are locked until the write
             completes.
         """
-        cdef TypeID mtype
         cdef hid_t self_id, mtype_id, mspace_id, fspace_id, plist_id
         cdef void* data
         cdef int oldflags
 
-        mtype = py_create(arr_obj.dtype)
+        if mtype is None:
+            mtype = py_create(arr_obj.dtype)
         check_numpy_read(arr_obj, -1)
 
         self_id = self.id
diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index d37a366..d408f95 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -747,6 +747,9 @@ class Dataset(HLObject):
                 else:
                     dtype = numpy.dtype(dtype)
 
+                if dtype.subdtype is not None:
+                    raise TypeError("ARRAY types are only supported as members of a compound type")
+
                 # Legacy
                 if any((compression, shuffle, fletcher32, maxshape)):
                     if chunks is False:

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



More information about the debian-science-commits mailing list