[h5py] 161/455: Temporary fix for __dealloc__ crash

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:28 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 82ee98e0181aa8d57bee1acced718ce048bc79ad
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Mon Nov 24 23:42:31 2008 +0000

    Temporary fix for __dealloc__ crash
---
 h5py/_extras.py   | 16 ++++++++--------
 h5py/h5.pyx       | 18 +++++++++---------
 h5py/h5g.pxd      |  2 +-
 h5py/h5t.pyx      |  7 -------
 h5py/highlevel.py |  2 +-
 5 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/h5py/_extras.py b/h5py/_extras.py
index f4224c3..d53c934 100644
--- a/h5py/_extras.py
+++ b/h5py/_extras.py
@@ -56,15 +56,15 @@ def h5sync(logger=None):
             fname = funcname(func)
 
             def wrap(*args, **kwds):
-                logger.debug( ("[ Call %s\n%s\n%s" % (fname, args, kwds)).replace("\n", "\n  ") )
-                try:
-                    with phil:
+                with phil:
+                    logger.debug( ("[ Call %s\n%s\n%s" % (fname, args, kwds)).replace("\n", "\n  ") )
+                    try:
                         retval = func(*args, **kwds)
-                except Exception, e:
-                    logger.debug('! Exception in %s: %s("%s")' % (fname, e.__class__.__name__, e))
-                    raise
-                logger.debug( ("] Exit %s\n%s" % (fname,retval)).replace("\n", "\n  ") )
-                return retval
+                    except Exception, e:
+                        logger.debug('! Exception in %s: %s("%s")' % (fname, e.__class__.__name__, e))
+                        raise
+                    logger.debug( ("] Exit %s\n%s" % (fname,retval)).replace("\n", "\n  ") )
+                    return retval
 
             uw_apply(wrap, func)
             return wrap
diff --git a/h5py/h5.pyx b/h5py/h5.pyx
index cb8a543..218f240 100644
--- a/h5py/h5.pyx
+++ b/h5py/h5.pyx
@@ -242,7 +242,6 @@ cdef class ObjectID:
                 return H5Iget_type(self.id) != H5I_BADID
             finally:
                 phil.release()
-
     
     def __nonzero__(self):
         """ Truth value for object identifiers (like _valid) """
@@ -259,14 +258,15 @@ cdef class ObjectID:
 
     def __dealloc__(self):
         """ Automatically decrefs the ID, if it's valid. """
-        phil.acquire()
-        try:
-            IF H5PY_DEBUG:
-                log_ident.debug("- %d" % self.id)
-            if (not self._locked) and H5Iget_type(self.id) != H5I_BADID:
-                H5Idec_ref(self.id)
-        finally:
-            phil.release()
+
+        # Acquiring PHIL leads to segfault in presence of cyclic
+        # garbage collection.  We'll have to hope this isn't called while
+        # an HDF5 callback is in progress.
+
+        IF H5PY_DEBUG:
+            log_ident.debug("- %d" % self.id)
+        if (not self._locked) and H5Iget_type(self.id) != H5I_BADID:
+            H5Idec_ref(self.id)
 
     
     def __copy__(self):
diff --git a/h5py/h5g.pxd b/h5py/h5g.pxd
index b4dd5ee..18f2e5b 100644
--- a/h5py/h5g.pxd
+++ b/h5py/h5g.pxd
@@ -18,7 +18,7 @@ from h5 cimport ObjectID
 cdef class GroupID(ObjectID):
 
     IF H5PY_18API:
-        cdef readonly object links
+        cdef public object links
     pass
 
 
diff --git a/h5py/h5t.pyx b/h5py/h5t.pyx
index 82d9b81..929ccb4 100644
--- a/h5py/h5t.pyx
+++ b/h5py/h5t.pyx
@@ -353,13 +353,6 @@ cdef class TypeID(ObjectID):
         cpy = ObjectID.__copy__(self)
         return cpy
 
-    def __repr__(self):
-        try:
-            dstr = " "+self.dtype.str
-        except Exception:
-            dstr = ""
-        return ObjectID.__repr__(self)+dstr
-
     property dtype:
         """ A Numpy-style dtype object representing this object.
         """
diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index e6c957b..e5cec76 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -74,7 +74,7 @@ class LockableObject(object):
         Base class which provides rudimentary locking support.
     """
 
-    _lock = threading.RLock()
+    _lock = h5.get_phil()
 
 
 class HLObject(LockableObject):

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