[h5py] 12/26: Fix refcount issue caused by 1.8.5 fixes
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 318063dcbf97075a54c1c238d87969b4f59c268a
Author: andrewcollette <andrew.collette at gmail.com>
Date: Sun Sep 26 12:30:56 2010 +0000
Fix refcount issue caused by 1.8.5 fixes
---
h5py/h5i.pyx | 6 +++++-
h5py/tests/low/test_h5i.py | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/h5py/h5i.pyx b/h5py/h5i.pyx
index 0ffb651..e7fc143 100644
--- a/h5py/h5i.pyx
+++ b/h5py/h5i.pyx
@@ -118,7 +118,11 @@ def get_file_id(ObjectID obj not None):
Obtain an identifier for the file in which this object resides.
"""
- return FileID(H5Iget_file_id(obj.id))
+ cdef hid_t fid
+ fid = H5Iget_file_id(obj.id)
+ if H5Iget_ref(fid) > 1:
+ H5Idec_ref(fid)
+ return FileID(fid)
def inc_ref(ObjectID obj not None):
diff --git a/h5py/tests/low/test_h5i.py b/h5py/tests/low/test_h5i.py
index 3fa80f9..fa4ff60 100644
--- a/h5py/tests/low/test_h5i.py
+++ b/h5py/tests/low/test_h5i.py
@@ -43,12 +43,12 @@ class TestName(Base):
class TestFID(Base):
def test_fid(self):
- """ (H5I) get_file_id() returns FID, with increased refcount """
+ """ (H5I) get_file_id() returns FID, with fixed refcount """
g = h5g.create(self.fid, '/foobar')
x = h5i.get_file_id(g)
self.assertIsInstance(x, h5f.FileID)
self.assertEqual(x, self.fid)
- self.assertEqual(h5i.get_ref(x), 2)
+ self.assertEqual(h5i.get_ref(x), 1)
def test_exc(self):
""" (H5I) get_file_id() on closed object raises ValueError """
--
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