[h5py] 13/455: Giving up on h5i.get_name

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:12 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 6fe19064232e9ecd6a117f6c5dca00ab8b3dfd34
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Wed May 7 19:08:00 2008 +0000

    Giving up on h5i.get_name
---
 h5py/h5i.pyx           | 14 +++++---------
 h5py/tests/test_h5i.py |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/h5py/h5i.pyx b/h5py/h5i.pyx
index 0d6f81e..1a80af9 100755
--- a/h5py/h5i.pyx
+++ b/h5py/h5i.pyx
@@ -20,7 +20,6 @@ from h5  cimport hid_t
 
 import h5
 from h5 import DDict
-from errors import H5Error
 
 # === Public constants and data structures ====================================
 
@@ -58,18 +57,15 @@ def get_name(hid_t obj_id):
 
         Determine (a) name of an HDF5 object.  Because an object has as many
         names as there are hard links to it, this may not be unique.  If the
-        object does not have a name (transient datatypes, etc.), the return
-        value is None.  If the identifier is invalid, raises H5Error.
+        object does not have a name (transient datatypes, etc.), or if the
+        identifier is invalid, returns None.
     """
-    cdef size_t namelen
+    cdef int namelen
     cdef char* name
 
-    namelen = H5Iget_name(obj_id, NULL, 0)
+    namelen = <int>H5Iget_name(obj_id, NULL, 0)
 
-    # H5Iget_type call is a workaround for changed behavior 1.6 to 1.8
-    if namelen < 0 or (H5I_BADID == H5Iget_type(obj_id)): 
-        raise H5Error("Failed to determine name of object %d" % obj_id)
-    if namelen == 0:
+    if namelen <= 0:
         return None
 
     name = <char*>malloc(namelen+1)
diff --git a/h5py/tests/test_h5i.py b/h5py/tests/test_h5i.py
index e859b4a..a026ee0 100644
--- a/h5py/tests/test_h5i.py
+++ b/h5py/tests/test_h5i.py
@@ -37,7 +37,7 @@ class TestH5I(unittest.TestCase):
     def test_get_name(self):
         self.assertEqual(h5i.get_name(self.obj), '/Group')
         self.assertEqual(h5i.get_name(h5t.STD_I8LE), None)
-        self.assertRaises(H5Error, h5i.get_name, -1)
+        self.assertEqual(h5i.get_name(-1), None)
 
 
 

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