[h5py] 162/455: Fix another crash in LinkProxy deallocation

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 322fdc1e7735bd83d3004ea6b2762a9543c9f83c
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Tue Nov 25 01:08:31 2008 +0000

    Fix another crash in LinkProxy deallocation
---
 h5py/_extras.py |  6 ++++++
 h5py/h5g.pxd    |  5 ++++-
 h5py/h5l.pxd    |  5 +++--
 h5py/h5l.pyx    | 10 ++++------
 4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/h5py/_extras.py b/h5py/_extras.py
index d53c934..cafdd16 100644
--- a/h5py/_extras.py
+++ b/h5py/_extras.py
@@ -17,6 +17,9 @@ from functools import update_wrapper
 from h5py.h5 import get_phil
 phil = get_phil()
 
+prof = {}
+from time import time
+
 def uw_apply(wrap, func):
     # Cython methods don't have a "module" attribute for some reason
     if hasattr(func, '__module__'):
@@ -58,12 +61,15 @@ def h5sync(logger=None):
             def wrap(*args, **kwds):
                 with phil:
                     logger.debug( ("[ Call %s\n%s\n%s" % (fname, args, kwds)).replace("\n", "\n  ") )
+                    stime = time()
                     try:
                         retval = func(*args, **kwds)
                     except Exception, e:
                         logger.debug('! Exception in %s: %s("%s")' % (fname, e.__class__.__name__, e))
                         raise
+                    otime = time()
                     logger.debug( ("] Exit %s\n%s" % (fname,retval)).replace("\n", "\n  ") )
+                    prof.setdefault(repr(func), set()).add(otime-stime)
                     return retval
 
             uw_apply(wrap, func)
diff --git a/h5py/h5g.pxd b/h5py/h5g.pxd
index 18f2e5b..6146669 100644
--- a/h5py/h5g.pxd
+++ b/h5py/h5g.pxd
@@ -15,10 +15,13 @@ include "defs.pxd"
 
 from h5 cimport ObjectID
 
+IF H5PY_18API:
+    from h5l cimport LinkProxy
+
 cdef class GroupID(ObjectID):
 
     IF H5PY_18API:
-        cdef public object links
+        cdef readonly object links
     pass
 
 
diff --git a/h5py/h5l.pxd b/h5py/h5l.pxd
index debc749..80f7e9f 100644
--- a/h5py/h5l.pxd
+++ b/h5py/h5l.pxd
@@ -14,7 +14,8 @@ include "defs.pxd"
 
 from h5 cimport ObjectID
 
-cdef class LinkProxy(ObjectID):
-  pass
+cdef class LinkProxy:
+
+    cdef hid_t id
 
 
diff --git a/h5py/h5l.pyx b/h5py/h5l.pyx
index f3a9465..e37f515 100644
--- a/h5py/h5l.pyx
+++ b/h5py/h5l.pyx
@@ -92,7 +92,7 @@ cdef herr_t cb_link_simple(hid_t grp, char* name, H5L_info_t *istruct, void* dat
     return 1
 
 
-cdef class LinkProxy(ObjectID):
+cdef class LinkProxy:
 
     """
         Proxy class which provides access to the HDF5 "H5L" API.
@@ -111,13 +111,11 @@ cdef class LinkProxy(ObjectID):
         * Equality: Undefined
     """
 
-    def __cinit__(self, hid_t id_):
-        # At this point the ObjectID constructor has already been called.
+    def __init__(self, hid_t id_):
 
         # The identifier in question is the hid_t for the parent GroupID.
-        # We need to manually incref the identifier because it's now
-        # shared by both this object and the parent.
-        H5Iinc_ref(self.id)
+        # We "borrow" this reference.
+        self.id = id_
 
     def __richcmp__(self, object other, int how):
         return NotImplemented

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