Mercurial > cpython-lru_cache-weakref
diff Python/dynload_shlib.c @ 76434:573010778eed
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.
| author | Brett Cannon <brett@python.org> |
|---|---|
| date | Fri, 20 Apr 2012 15:22:50 -0400 |
| parents | 2dd046be2c88 |
| children | 257cbd2fac38 |
line wrap: on
line diff
--- a/Python/dynload_shlib.c Fri Apr 20 19:59:20 2012 +0200 +++ b/Python/dynload_shlib.c Fri Apr 20 15:22:50 2012 -0400 @@ -129,10 +129,19 @@ 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)
