summaryrefslogtreecommitdiff
path: root/Python/dynload_shlib.c
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-04-20 15:22:50 -0400
committerBrett Cannon <brett@python.org>2012-04-20 15:22:50 -0400
commit7fba2a9968a7b5c426dad6a2b02b95da914853ca (patch)
tree1d16e014bc317b3ad7c4c507adde97d91550ad13 /Python/dynload_shlib.c
parente4dd7bd0e0adbf434aea7cd03288ef3c5add9fb8 (diff)
downloadcpython-7fba2a9968a7b5c426dad6a2b02b95da914853ca.tar.gz
Issue #14599: Generalize a test for ImportError.path and add support
in Python/dynload_shlibs.c. This should fix the remaining importlib test failure on Windows. Support in AIX and HP-UX will be in a separate checkin.
Diffstat (limited to 'Python/dynload_shlib.c')
-rw-r--r--Python/dynload_shlib.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 94c6494ee2..565facaf71 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -129,10 +129,19 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
handle = dlopen(pathname, dlopenflags);
if (handle == NULL) {
+ PyObject *mod_name = NULL;
+ PyObject *path = NULL;
+ PyObject *error_ob = NULL;
const char *error = dlerror();
if (error == NULL)
error = "unknown dlopen() error";
- PyErr_SetString(PyExc_ImportError, error);
+ error_ob = PyUnicode_FromString(error);
+ path = PyUnicode_FromString(pathname);
+ mod_name = PyUnicode_FromString(shortname);
+ PyErr_SetImportError(error_ob, mod_name, path);
+ Py_DECREF(error_ob);
+ Py_DECREF(path);
+ Py_DECREF(mod_name);
return NULL;
}
if (fp != NULL && nhandles < 128)