[h5py] 18/26: Disable atexit auto-closing of IDs for HDF5 1.8+ (issue 136).

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


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

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

commit 227d4800073e3a656632a33bc9fb68b0cada0e89
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Sun Nov 28 20:16:59 2010 +0000

    Disable atexit auto-closing of IDs for HDF5 1.8+ (issue 136).
---
 h5py/defs.pxd |  4 ++++
 h5py/h5.pyx   | 33 +++++++++++++++++++--------------
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/h5py/defs.pxd b/h5py/defs.pxd
index f2cf80c..3141894 100644
--- a/h5py/defs.pxd
+++ b/h5py/defs.pxd
@@ -89,6 +89,10 @@ cdef extern from "hdf5.h":
   herr_t H5get_libversion(unsigned *majnum, unsigned *minnum,
                           unsigned *relnum) except *
 
+  int H5_VERS_MAJOR
+  int H5_VERS_MINOR
+  int H5_VERS_RELEASE
+  
 # === H5D - Dataset API =======================================================
 
 cdef extern from "hdf5.h":
diff --git a/h5py/h5.pyx b/h5py/h5.pyx
index 572d830..0949362 100644
--- a/h5py/h5.pyx
+++ b/h5py/h5.pyx
@@ -334,25 +334,30 @@ def _open():
 def _exithack():
     """ Internal function; do not call unless you want to lose all your data.
     """
-    # If any identifiers have reference counts > 1 when the library closes,
-    # it freaks out and dumps a message to stderr.  So we have Python dec_ref
-    # everything when the interpreter's about to exit.
+
 
     cdef int count
     cdef int i
     cdef hid_t *objs
 
-    count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL)
-
-    if count > 0:
-        objs = <hid_t*>malloc(sizeof(hid_t)*count)
-        try:
-            H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, count, objs)
-            for i from 0<=i<count:
-                while H5Iget_type(objs[i]) != H5I_BADID and H5Iget_ref(objs[i]) > 0:
-                    H5Idec_ref(objs[i])
-        finally:
-            free(objs)
+    # This problem appears to be fixed in HDF5 1.8
+    if H5_VERS_MAJOR == 1 and H5_VERS_MINOR < 8:
+    
+        # If any identifiers have reference counts > 1 when the library closes,
+        # it freaks out and dumps a message to stderr.  So we have Python dec_ref
+        # everything when the interpreter's about to exit.
+    
+        count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL)
+
+        if count > 0:
+            objs = <hid_t*>malloc(sizeof(hid_t)*count)
+            try:
+                H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, count, objs)
+                for i from 0<=i<count:
+                    while H5Iget_type(objs[i]) != H5I_BADID and H5Iget_ref(objs[i]) > 0:
+                        H5Idec_ref(objs[i])
+            finally:
+                free(objs)
 
     _conv.unregister_converters()
 

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