[h5py] 213/455: Fix error-handling issue in threaded mode

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 95a83631fc85b13235d77ebc3d4771e238288c1b
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Sat Jan 31 23:08:28 2009 +0000

    Fix error-handling issue in threaded mode
---
 h5py/h5.pyx | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/h5py/h5.pyx b/h5py/h5.pyx
index ab86113..c87288c 100644
--- a/h5py/h5.pyx
+++ b/h5py/h5.pyx
@@ -195,6 +195,7 @@ cdef class PHIL:
         self.lock.release()
         return 0
     cpdef bint acquire(self, int blocking=1) except -1:
+        register_thread()
         cdef bint rval = self.lock.acquire(blocking)
         return rval
     cpdef bint release(self) except -1:
@@ -702,6 +703,13 @@ def _exithack():
 
 hdf5_inited = 0
 
+cpdef int register_thread() except -1:
+    """ Register the current thread for native HDF5 exception support.
+    """
+    if H5Eset_auto(err_callback, NULL) < 0:
+        raise RuntimeError("Failed to register HDF5 exception callback")
+    return 0
+
 cdef int init_hdf5() except -1:
     # Initialize the library and register Python callbacks for exception
     # handling.  Safe to call more than once.
@@ -712,8 +720,7 @@ cdef int init_hdf5() except -1:
             log_lib.info("* Initializing h5py library")
         if H5open() < 0:
             raise RuntimeError("Failed to initialize the HDF5 library.")
-        if H5Eset_auto(err_callback, NULL) < 0:
-            raise RuntimeError("Failed to register HDF5 exception callback.")
+        register_thread()
         if register_lzf() < 0:
             raise RuntimeError("Failed to register LZF filter")
         atexit.register(_exithack)

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