summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshireenrao <shireenrao@gmail.com>2019-08-17 20:50:39 (GMT)
committerSteve Dower <steve.dower@python.org>2019-08-17 20:50:39 (GMT)
commit24fe46081be3d1c01b3d21cb39bc3492ab4485a3 (patch)
treebb5e5b4fce64620aebb027c0e2b8cca02c572fc5
parent455856391c2b4e2af79de55101421cd15901edaf (diff)
downloadcpython-24fe46081be3d1c01b3d21cb39bc3492ab4485a3.zip
cpython-24fe46081be3d1c01b3d21cb39bc3492ab4485a3.tar.gz
cpython-24fe46081be3d1c01b3d21cb39bc3492ab4485a3.tar.bz2
bpo-36266: Add module name in ImportError when DLL not found on Windows (GH-15180)
-rw-r--r--Misc/NEWS.d/next/Windows/2019-08-08-18-05-27.bpo-36266.x4eZU3.rst1
-rw-r--r--Python/dynload_win.c8
2 files changed, 5 insertions, 4 deletions
diff --git a/Misc/NEWS.d/next/Windows/2019-08-08-18-05-27.bpo-36266.x4eZU3.rst b/Misc/NEWS.d/next/Windows/2019-08-08-18-05-27.bpo-36266.x4eZU3.rst
new file mode 100644
index 0000000..86fdd6f
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2019-08-08-18-05-27.bpo-36266.x4eZU3.rst
@@ -0,0 +1 @@
+Add the module name in the formatted error message when DLL load fail happens during module import in ``_PyImport_FindSharedFuncptrWindows()``. Patch by Srinivas Nyayapati. \ No newline at end of file
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index 5096555..6deba11 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -240,8 +240,8 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
This should not happen if called correctly. */
if (theLength == 0) {
message = PyUnicode_FromFormat(
- "DLL load failed with error code %u",
- errorCode);
+ "DLL load failed with error code %u while importing %s",
+ errorCode, shortname);
} else {
/* For some reason a \r\n
is appended to the text */
@@ -251,8 +251,8 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
theLength -= 2;
theInfo[theLength] = '\0';
}
- message = PyUnicode_FromString(
- "DLL load failed: ");
+ message = PyUnicode_FromFormat(
+ "DLL load failed while importing %s: ", shortname);
PyUnicode_AppendAndDel(&message,
PyUnicode_FromWideChar(