[h5py] 387/455: Make anon object creation consistent

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:53 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 801beb1dc700d699ba592babcd06a601b05c2f43
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Mon Feb 8 00:05:23 2010 +0000

    Make anon object creation consistent
---
 h5py/h5d.pyx               |  2 +-
 h5py/h5g.pyx               | 14 +++++++++-----
 h5py/tests/low/test_h5g.py |  2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/h5py/h5d.pyx b/h5py/h5d.pyx
index 861f6a1..6cd4b34 100644
--- a/h5py/h5d.pyx
+++ b/h5py/h5d.pyx
@@ -60,7 +60,7 @@ IF H5PY_18API:
 
     def create(ObjectID loc not None, object name, TypeID tid not None,
                SpaceID space not None, PropID dcpl=None, PropID lcpl=None):
-        """ (objectID loc, [STRING name,], TypeID tid, SpaceID space,
+        """ (objectID loc, STRING name or None, TypeID tid, SpaceID space,
              PropDCID dcpl=None, PropID lcpl=None) => DatasetID
 
         Create a new dataset.  If "name" is None, the dataset will be
diff --git a/h5py/h5g.pyx b/h5py/h5g.pyx
index ef2ec9b..5ea83b0 100644
--- a/h5py/h5g.pyx
+++ b/h5py/h5g.pyx
@@ -126,18 +126,22 @@ def open(ObjectID loc not None, char* name):
 
 IF H5PY_18API:
     
-    def create(ObjectID loc not None, char* name=NULL, PropID lcpl=None,
+    def create(ObjectID loc not None, object name, PropID lcpl=None,
                PropID gcpl=None):
-        """(ObjectID loc, [STRING name,] PropLCID lcpl=None, PropGCID gcpl=None)
+        """(ObjectID loc, STRING name or None, PropLCID lcpl=None,
+            PropGCID gcpl=None)
         => GroupID
 
-        Create a new group, under a given parent group.  If name is omitted,
+        Create a new group, under a given parent group.  If name is None,
         an anonymous group will be created in the file.
         """
         cdef hid_t gid
+        cdef char* cname = NULL
+        if name is not None:
+            cname = name
 
-        if name != NULL:
-            gid = H5Gcreate2(loc.id, name, pdefault(lcpl), pdefault(gcpl), H5P_DEFAULT)
+        if cname != NULL:
+            gid = H5Gcreate2(loc.id, cname, pdefault(lcpl), pdefault(gcpl), H5P_DEFAULT)
         else:
             gid = H5Gcreate_anon(loc.id, pdefault(gcpl), H5P_DEFAULT)
 
diff --git a/h5py/tests/low/test_h5g.py b/h5py/tests/low/test_h5g.py
index 19d7ae9..5fe6134 100644
--- a/h5py/tests/low/test_h5g.py
+++ b/h5py/tests/low/test_h5g.py
@@ -15,7 +15,7 @@ class TestCreate(tests.HTest):
     @tests.require(api=18)
     def test_create_anon(self):
         """ (H5G) Anonymous group creation """
-        gid = h5g.create(self.fid)
+        gid = h5g.create(self.fid, None)
         self.assert_(gid)
         self.assertIsInstance(gid, h5g.GroupID)
 

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