summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Muller <?@?>2010-11-20 11:15:54 -0700
committerPauli Virtanen <pav@iki.fi>2010-11-20 22:02:20 +0100
commitf1f52d6c962bf0ada57d8332b3fbd863bb1ca6cd (patch)
tree05c689e9bfb20da338c464b71683c8cc654640af
parent02f61bcd3812c381559fd714bae9a5a8f275879e (diff)
downloadnumpy-f1f52d6c962bf0ada57d8332b3fbd863bb1ca6cd.tar.gz
BUG: Fix exception handling for python 3k.
-rw-r--r--numpy/ctypeslib.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/ctypeslib.py b/numpy/ctypeslib.py
index ccaa3cfd6..1fdf3c396 100644
--- a/numpy/ctypeslib.py
+++ b/numpy/ctypeslib.py
@@ -93,7 +93,6 @@ else:
"with ctypes < 1.0.1")
ext = os.path.splitext(libname)[1]
-
if not ext:
# Try to load library with platform-specific name, otherwise
# default to libname.[so|pyd]. Sometimes, these files are built
@@ -112,14 +111,15 @@ else:
else:
libdir = loader_path
+ # Need to save exception when using Python 3k, see PEP 3110.
+ exc = None
for ln in libname_ext:
try:
libpath = os.path.join(libdir, ln)
return ctypes.cdll[libpath]
except OSError, e:
- pass
-
- raise e
+ exc = e
+ raise exc
ctypes_load_library = deprecate(load_library, 'ctypes_load_library',
'load_library')