[h5py] 322/455: Fix get_select_bounds for empty selection (#73)

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:46 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 1e65e99593979103cc2ee7fdea70184a4fb041f6
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Tue Nov 24 04:29:57 2009 +0000

    Fix get_select_bounds for empty selection (#73)
---
 h5py/h5s.pyx           | 3 +++
 h5py/tests/test_h5s.py | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/h5py/h5s.pyx b/h5py/h5s.pyx
index b3fa11b..a2116b0 100644
--- a/h5py/h5s.pyx
+++ b/h5py/h5s.pyx
@@ -374,6 +374,9 @@ cdef class SpaceID(ObjectID):
 
         rank = H5Sget_simple_extent_ndims(self.id)
 
+        if H5Sget_select_npoints(self.id) == 0:
+            return None
+
         start = <hsize_t*>emalloc(sizeof(hsize_t)*rank)
         end = <hsize_t*>emalloc(sizeof(hsize_t)*rank)
 
diff --git a/h5py/tests/test_h5s.py b/h5py/tests/test_h5s.py
index 4f8646e..184bf34 100644
--- a/h5py/tests/test_h5s.py
+++ b/h5py/tests/test_h5s.py
@@ -108,6 +108,8 @@ class TestH5S(unittest.TestCase):
         self.assertEqual(sid.get_select_bounds(), ((0,0), (99,99)))
         sid.select_hyperslab((10,10), (13,17))
         self.assertEqual(sid.get_select_bounds(), ((10,10), (22,26)))
+        sid.select_none()
+        self.assert_(sid.get_select_bounds() is None)
 
     def test_select(self):
         # all, none, valid

-- 
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