Issue #3313: Contrary to the man page, a failed dlopen() call does not
always set a dlerror() message.
This commit is contained in:
parent
7103aa42c0
commit
880f529c04
|
@ -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.
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue