summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2008-07-15 19:39:38 (GMT)
committerThomas Heller <theller@ctypes.org>2008-07-15 19:39:38 (GMT)
commit880f529c04a5093e017bd41cf976ac62539a132c (patch)
tree406c385357c53db89c939dea359c4c20731011a7 /Modules
parent7103aa42c0d3ce8d75c9a9e299cf4d9b0be544de (diff)
downloadcpython-880f529c04a5093e017bd41cf976ac62539a132c.zip
cpython-880f529c04a5093e017bd41cf976ac62539a132c.tar.gz
cpython-880f529c04a5093e017bd41cf976ac62539a132c.tar.bz2
Issue #3313: Contrary to the man page, a failed dlopen() call does not
always set a dlerror() message.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/callproc.c5
-rw-r--r--Modules/dlmodule.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index b16d7b0..01ba8a0 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -1410,8 +1410,11 @@ static PyObject *py_dl_open(PyObject *self, PyObject *args)
mode |= RTLD_NOW;
handle = ctypes_dlopen(name, mode);
if (!handle) {
+ char *errmsg = ctypes_dlerror();
+ if (!errmsg)
+ errmsg = "dlopen() error";
PyErr_SetString(PyExc_OSError,
- ctypes_dlerror());
+ errmsg);
return NULL;
}
return PyLong_FromVoidPtr(handle);
diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c
index ccf1cb1..b2ea4f5 100644
--- a/Modules/dlmodule.c
+++ b/Modules/dlmodule.c
@@ -186,7 +186,10 @@ dl_open(PyObject *self, PyObject *args)
}
handle = dlopen(name, mode);
if (handle == NULL) {
- PyErr_SetString(Dlerror, dlerror());
+ char *errmsg = dlerror();
+ if (!errmsg)
+ errmsg = "dlopen() error";
+ PyErr_SetString(Dlerror, errmsg);
return NULL;
}
#ifdef __VMS