summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/ctypeslib.py7
-rw-r--r--numpy/tests/test_ctypeslib.py16
2 files changed, 22 insertions, 1 deletions
diff --git a/numpy/ctypeslib.py b/numpy/ctypeslib.py
index 9fbfc7e87..d64fd43e4 100644
--- a/numpy/ctypeslib.py
+++ b/numpy/ctypeslib.py
@@ -29,7 +29,10 @@ else:
import warnings
warnings.warn("All features of ctypes interface may not work " \
"with ctypes < 1.0.1")
- if '.' not in libname:
+
+ 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
# erroneously on non-linux platforms.
@@ -38,6 +41,8 @@ else:
libname_ext.insert(0, '%s.dll' % libname)
elif sys.platform == 'darwin':
libname_ext.insert(0, '%s.dylib' % libname)
+ else:
+ libname_ext = [libname]
loader_path = os.path.abspath(loader_path)
if not os.path.isdir(loader_path):
diff --git a/numpy/tests/test_ctypeslib.py b/numpy/tests/test_ctypeslib.py
index ceb574911..5d21a09ea 100644
--- a/numpy/tests/test_ctypeslib.py
+++ b/numpy/tests/test_ctypeslib.py
@@ -12,6 +12,22 @@ class TestLoadLibrary(NumpyTestCase):
" (import error was: %s)" % str(e)
print msg
+ def check_basic2(self):
+ """Regression for #801: load_library with a full library name
+ (including extension) does not work."""
+ try:
+ try:
+ from distutils import sysconfig
+ so = sysconfig.get_config_var('SO')
+ cdll = load_library('multiarray%s' % so,
+ np.core.multiarray.__file__)
+ except ImportError:
+ print "No distutils available, skipping test."
+ except ImportError, e:
+ msg = "ctypes is not available on this python: skipping the test" \
+ " (import error was: %s)" % str(e)
+ print msg
+
class TestNdpointer(NumpyTestCase):
def check_dtype(self):
dt = np.intc