]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport:
authorNeal Norwitz <nnorwitz@gmail.com>
Wed, 9 Nov 2005 07:02:40 +0000 (07:02 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Wed, 9 Nov 2005 07:02:40 +0000 (07:02 +0000)
 SF Bug #1350188, "setdlopenflags" leads to crash upon "import"
 It was possible dlerror() returns a NULL pointer, use a default error
 message in this case.

Misc/NEWS
Python/dynload_shlib.c

index ba21bfd435b90497b0a849b948aa10a501372aa2..8bc7a81ec71451fed3ac2224ca3a04e8d0d77d09 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,10 @@ What's New in Python 2.4.3c1?
 Core and builtins
 -----------------
 
+- SF Bug #1350188, "setdlopenflags" leads to crash upon "import"
+  It was possible dlerror() returns a NULL pointer, use a default error
+  message in this case.
+
 - SF bug #1167751: fix incorrect code being for generator expressions.
   The following code now raises a SyntaxError:  foo(a = i for i in range(10))
 
index 2b5a11a220eed74a73b51f6d9c3cae52996aff32..960e5c0933784fb980ccea36e23425a2d88d2ff0 100644 (file)
@@ -130,7 +130,10 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
        handle = dlopen(pathname, dlopenflags);
 
        if (handle == NULL) {
-               PyErr_SetString(PyExc_ImportError, dlerror());
+               char *error = dlerror();
+               if (error == NULL)
+                       error = "unknown dlopen() error";
+               PyErr_SetString(PyExc_ImportError, error);
                return NULL;
        }
        if (fp != NULL && nhandles < 128)