Issue #3313: Contrary to the man page, a failed dlopen() call does not

always set a dlerror() message.
This commit is contained in:
Thomas Heller 2008-07-15 19:39:38 +00:00
parent 7103aa42c0
commit 880f529c04
3 changed files with 11 additions and 2 deletions

View File

@ -57,6 +57,9 @@ Core and Builtins
Library
-------
- Issue #3313: Fixed a crash when a failed dlopen() call does not set
a valid dlerror() message.
- Issue #3258: Fixed a crash when a ctypes POINTER type to an
incomplete structure was created.

View File

@ -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);

View File

@ -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