Commit 24fe4608 authored by shireenrao's avatar shireenrao Committed by Steve Dower

bpo-36266: Add module name in ImportError when DLL not found on Windows (GH-15180)

parent 45585639
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
......@@ -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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment