diff options
Diffstat (limited to 'Python/dynload_shlib.c')
-rw-r--r-- | Python/dynload_shlib.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 7ea510e..565faca 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -39,7 +39,6 @@ const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef __CYGWIN__ {".dll", "rb", C_EXTENSION}, - {"module.dll", "rb", C_EXTENSION}, #else /* !__CYGWIN__ */ #if defined(PYOS_OS2) && defined(PYCC_GCC) {".pyd", "rb", C_EXTENSION}, @@ -48,15 +47,10 @@ const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef __VMS {".exe", "rb", C_EXTENSION}, {".EXE", "rb", C_EXTENSION}, - {"module.exe", "rb", C_EXTENSION}, - {"MODULE.EXE", "rb", C_EXTENSION}, #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}, #endif /* __VMS */ #endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */ #endif /* __CYGWIN__ */ @@ -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_DECREF(error_ob); + Py_DECREF(path); + Py_DECREF(mod_name); return NULL; } if (fp != NULL && nhandles < 128) |