summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2008-07-15 19:46:52 (GMT)
committerThomas Heller <theller@ctypes.org>2008-07-15 19:46:52 (GMT)
commit15383a08aa192247de222e4c1a29b6c4b19dbc26 (patch)
treebb5c814f07691f26ac7ae7034bc8cc729d413b3d
parenta7024e9e849957f0f0a8ac9ad4684be331b3c6f6 (diff)
downloadcpython-15383a08aa192247de222e4c1a29b6c4b19dbc26.zip
cpython-15383a08aa192247de222e4c1a29b6c4b19dbc26.tar.gz
cpython-15383a08aa192247de222e4c1a29b6c4b19dbc26.tar.bz2
Merged revisions 64976-64977 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64976 | thomas.heller | 2008-07-15 21:39:38 +0200 (Tue, 15 Jul 2008) | 3 lines Issue #3313: Contrary to the man page, a failed dlopen() call does not always set a dlerror() message. ........ r64977 | thomas.heller | 2008-07-15 21:44:25 +0200 (Tue, 15 Jul 2008) | 2 lines Add Victor Stinner, he provided the patch for issue #3313. ........
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/_ctypes/callproc.c5
3 files changed, 8 insertions, 1 deletions
diff --git a/Misc/ACKS b/Misc/ACKS
index ce010d5..dbb2035 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -771,3 +771,4 @@ Uwe Zessin
Amaury Forgeot d'Arc
Peter Åstrand
Tarek ZiadŽ
+Victor Stinner
diff --git a/Misc/NEWS b/Misc/NEWS
index 010c06f..3272f00 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,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.
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 0a305ed..d452785 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -1383,8 +1383,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);