summaryrefslogtreecommitdiff
path: root/Python/dynload_shlib.c
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2013-03-13 21:35:07 -0400
committerTerry Jan Reedy <tjreedy@udel.edu>2013-03-13 21:35:07 -0400
commit6e1f43c7134a81fa559ae0958d257de28337ab6f (patch)
tree6d1e53c5b5637f60f96fddad23ec2072daa0ef60 /Python/dynload_shlib.c
parent8c41e21d39e424334a15a2e9ac922f0ac0f59a39 (diff)
parent3a12ade6e1b2a96e92348ed851c8fa66d20dfa99 (diff)
downloadcpython-6e1f43c7134a81fa559ae0958d257de28337ab6f.tar.gz
Merge with 3.2: Issue #17386
Diffstat (limited to 'Python/dynload_shlib.c')
-rw-r--r--Python/dynload_shlib.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 7ea510e862..0ca65c7877 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -36,31 +36,25 @@
live in the same directory. E.g. foomodule.cpython-32.so
*/
-const struct filedescr _PyImport_DynLoadFiletab[] = {
+const char *_PyImport_DynLoadFiletab[] = {
#ifdef __CYGWIN__
- {".dll", "rb", C_EXTENSION},
- {"module.dll", "rb", C_EXTENSION},
+ ".dll",
#else /* !__CYGWIN__ */
#if defined(PYOS_OS2) && defined(PYCC_GCC)
- {".pyd", "rb", C_EXTENSION},
- {".dll", "rb", C_EXTENSION},
+ ".pyd",
+ ".dll",
#else /* !(defined(PYOS_OS2) && defined(PYCC_GCC)) */
#ifdef __VMS
- {".exe", "rb", C_EXTENSION},
- {".EXE", "rb", C_EXTENSION},
- {"module.exe", "rb", C_EXTENSION},
- {"MODULE.EXE", "rb", C_EXTENSION},
+ ".exe",
+ ".EXE",
#else /* !__VMS */
- {"." SOABI ".so", "rb", C_EXTENSION},
- {"module." SOABI ".so", "rb", C_EXTENSION},
- {".abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION},
- {"module.abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION},
- {".so", "rb", C_EXTENSION},
- {"module.so", "rb", C_EXTENSION},
+ "." SOABI ".so",
+ ".abi" PYTHON_ABI_STRING ".so",
+ ".so",
#endif /* __VMS */
#endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */
#endif /* __CYGWIN__ */
- {0, 0}
+ NULL,
};
static struct {
@@ -75,7 +69,7 @@ static struct {
static int nhandles = 0;
-dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
+dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
const char *pathname, FILE *fp)
{
dl_funcptr p;
@@ -121,10 +115,6 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
dlopenflags = PyThreadState_GET()->interp->dlopenflags;
#endif
- if (Py_VerboseFlag)
- PySys_WriteStderr("dlopen(\"%s\", %x);\n", pathname,
- dlopenflags);
-
#ifdef __VMS
/* VMS currently don't allow a pathname, use a logical name instead */
/* Concatenate 'python_module_' and shortname */
@@ -139,10 +129,19 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, 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_XDECREF(error_ob);
+ Py_XDECREF(path);
+ Py_XDECREF(mod_name);
return NULL;
}
if (fp != NULL && nhandles < 128)