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.
This commit is contained in:
Brett Cannon 2012-04-20 15:22:50 -04:00
parent 3c23a87e58
commit f0434e647a
4 changed files with 26 additions and 27 deletions

View file

@ -74,10 +74,11 @@ _PyImport_LoadDynamicModule(PyObject *name, PyObject *path, FILE *fp)
if (PyErr_Occurred())
goto error;
if (p == NULL) {
PyErr_Format(PyExc_ImportError,
"dynamic module does not define init function"
" (PyInit_%s)",
shortname);
PyObject *msg = PyUnicode_FromFormat("dynamic module does not define "
"init function (PyInit_%s)",
shortname);
PyErr_SetImportError(msg, name, path);
Py_DECREF(msg);
goto error;
}
oldcontext = _Py_PackageContext;