mirror of https://github.com/python/cpython
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
|
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
|
- Issue #3258: Fixed a crash when a ctypes POINTER type to an
|
||||||
incomplete structure was created.
|
incomplete structure was created.
|
||||||
|
|
||||||
|
|
|
@ -1410,8 +1410,11 @@ static PyObject *py_dl_open(PyObject *self, PyObject *args)
|
||||||
mode |= RTLD_NOW;
|
mode |= RTLD_NOW;
|
||||||
handle = ctypes_dlopen(name, mode);
|
handle = ctypes_dlopen(name, mode);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
|
char *errmsg = ctypes_dlerror();
|
||||||
|
if (!errmsg)
|
||||||
|
errmsg = "dlopen() error";
|
||||||
PyErr_SetString(PyExc_OSError,
|
PyErr_SetString(PyExc_OSError,
|
||||||
ctypes_dlerror());
|
errmsg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return PyLong_FromVoidPtr(handle);
|
return PyLong_FromVoidPtr(handle);
|
||||||
|
|
|
@ -186,7 +186,10 @@ dl_open(PyObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
handle = dlopen(name, mode);
|
handle = dlopen(name, mode);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
PyErr_SetString(Dlerror, dlerror());
|
char *errmsg = dlerror();
|
||||||
|
if (!errmsg)
|
||||||
|
errmsg = "dlopen() error";
|
||||||
|
PyErr_SetString(Dlerror, errmsg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
|
|
Loading…
Reference in New Issue