[h5py] 03/26: All HLObjects should hold a strong reference to their File object (issue #106)

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:20:16 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 61e2365efd1291face1e11c830c1a940b00f326d
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Sat Apr 17 23:19:11 2010 +0000

    All HLObjects should hold a strong reference to their File object (issue #106)
---
 h5py/highlevel.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index 08a0a04..c700849 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -91,9 +91,7 @@ class HLObject(object):
     @property
     def file(self):
         """Return a File instance associated with this object"""
-        register_thread()
-        fid = h5i.get_file_id(self.id)
-        return File(None, bind=fid)
+        return self._file
 
     @property
     def _lapl(self):
@@ -146,8 +144,11 @@ class HLObject(object):
 
     def __init__(self, oid):
         """ Setup this object, given its low-level identifier """
-        #self._file = self._get_file(oid)
+        register_thread()
         self._id = oid
+        if not isinstance(self, File):
+            fid = h5i.get_file_id(oid)
+            self._file = File(None, bind=fid)
 
     def __nonzero__(self):
         register_thread()

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