summaryrefslogtreecommitdiffstats
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-04-20 19:22:50 (GMT)
committerBrett Cannon <brett@python.org>2012-04-20 19:22:50 (GMT)
commitf0434e647aa3e7b82a740be4a820aec951a885ac (patch)
treeea6c3e0d3b874549cc081a54e0e0c63ac132da38 /Python/importdl.c
parent3c23a87e58ba5ba3161eaacae98a49a79e1f2786 (diff)
downloadcpython-f0434e647aa3e7b82a740be4a820aec951a885ac.zip
cpython-f0434e647aa3e7b82a740be4a820aec951a885ac.tar.gz
cpython-f0434e647aa3e7b82a740be4a820aec951a885ac.tar.bz2
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/importdl.c')
-rw-r--r--Python/importdl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index 734b35f..942e4b8 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -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;