[h5py] 17/455: h5/error updates
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:12 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 f25f4f45f16ffa3e990cf7711e5167ecf790cdf1
Author: andrewcollette <andrew.collette at gmail.com>
Date: Thu May 8 23:55:24 2008 +0000
h5/error updates
---
h5py/errors.py | 4 +---
h5py/h5.pxd | 4 ++++
h5py/h5.pyx | 40 +++++++++++++++++++++++-----------------
3 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/h5py/errors.py b/h5py/errors.py
index 1534f3d..ba3655e 100644
--- a/h5py/errors.py
+++ b/h5py/errors.py
@@ -24,9 +24,7 @@ class H5LibraryError(H5Error):
arglist = list(args)
if len(arglist) == 0:
arglist = [""]
- msg = arglist[0]
- msg += "\n"+get_error_string()
- arglist[0] = msg
+ arglist[0] = arglist[0] + "\n" + get_error_string()
args = tuple(arglist)
H5Error.__init__(self, *args, **kwds)
diff --git a/h5py/h5.pxd b/h5py/h5.pxd
index 48f8805..008da98 100644
--- a/h5py/h5.pxd
+++ b/h5py/h5.pxd
@@ -40,4 +40,8 @@ cdef extern from "hdf5.h":
unsigned *relnum )
herr_t H5check_version(unsigned majnum, unsigned minnum,
unsigned relnum )
+ herr_t H5garbage_collect()
+
+
+
diff --git a/h5py/h5.pyx b/h5py/h5.pyx
index 8c7274c..8104d72 100644
--- a/h5py/h5.pyx
+++ b/h5py/h5.pyx
@@ -14,23 +14,30 @@
"""
Private initialization module for the h5* family of modules.
- ** Not for public use. **
-
Common module for the HDF5 low-level interface library. This module
is imported at the top of every h5* sub-module. Initializes the
library and defines common version info, classes and functions.
+
+ Library version and API information lives here:
+ - HDF5_VERS, HDF5_VERS_TPL: Library version
+ - API_VERS, API_VERS_TPL: API version (1.6 or 1.8) used to compile
"""
from h5e cimport H5Eset_auto, H5E_walk_t, H5Ewalk, H5E_error_t, \
H5E_WALK_DOWNWARD
+from errors import H5LibraryError
+
# Activate the library
H5open()
# Disable automatic error printing to stderr
H5Eset_auto(NULL, NULL)
-def _getversionastuple():
+def get_libversion():
+ """ () => TUPLE (major, minor, release)
+ Retrieve the HDF5 library version as a 3-tuple.
+ """
cdef unsigned int major
cdef unsigned int minor
cdef unsigned int release
@@ -38,30 +45,26 @@ def _getversionastuple():
retval = H5get_libversion(&major, &minor, &release)
if retval < 0:
- raise RuntimeError("Error determining HDF5 library version")
+ raise H5LibraryError("Error determining HDF5 library version.")
return (major, minor, release)
-HDF5_VERS_TPL = _getversionastuple()
+#: HDF5 library version as a 3-tuple (major, minor, release), e.g. (1,6,5)
+HDF5_VERS_TPL = get_libversion()
+
+#: HDF5 library version as a string "major.minor.release", e.g. "1.6.5"
HDF5_VERS = "%d.%d.%d" % HDF5_VERS_TPL
+#: API version used to compile, as a string "major.minor", e.g. "1.6"
API_VERS = '1.6'
-API_VERS_TPL = (1,6)
-
-def cycle():
- """ ()
- Force the HDF5 library to close all open objects and files, and re-
- initialize the library.
- """
- cdef herr_t retval
- H5close()
- retval = H5open()
- if retval < 0:
- raise RuntimeError("Failed to re-initialize the HDF5 library")
+#: API version used to compile, as a 2-tuple (major, minor), e.g. (1,6)
+API_VERS_TPL = (1,6)
class DDict(dict):
+ """ Internal class.
+ """
def __missing__(self, key):
return '*INVALID* (%s)' % str(key)
@@ -81,7 +84,10 @@ cdef herr_t walk_cb(int n, H5E_error_t *err_desc, data):
return 0
def get_error_string():
+ """ Internal function; don't use directly.
+ Get the HDF5 error stack contents as a string.
+ """
elist = []
H5Ewalk(H5E_WALK_DOWNWARD, walk_cb, elist)
--
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