mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-36266: Add module name in ImportError when DLL not found on Windows (GH-15180)
This commit is contained in:
parent
455856391c
commit
24fe46081b
2 changed files with 5 additions and 4 deletions
|
@ -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.
|
|
@ -240,8 +240,8 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
||||||
This should not happen if called correctly. */
|
This should not happen if called correctly. */
|
||||||
if (theLength == 0) {
|
if (theLength == 0) {
|
||||||
message = PyUnicode_FromFormat(
|
message = PyUnicode_FromFormat(
|
||||||
"DLL load failed with error code %u",
|
"DLL load failed with error code %u while importing %s",
|
||||||
errorCode);
|
errorCode, shortname);
|
||||||
} else {
|
} else {
|
||||||
/* For some reason a \r\n
|
/* For some reason a \r\n
|
||||||
is appended to the text */
|
is appended to the text */
|
||||||
|
@ -251,8 +251,8 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
||||||
theLength -= 2;
|
theLength -= 2;
|
||||||
theInfo[theLength] = '\0';
|
theInfo[theLength] = '\0';
|
||||||
}
|
}
|
||||||
message = PyUnicode_FromString(
|
message = PyUnicode_FromFormat(
|
||||||
"DLL load failed: ");
|
"DLL load failed while importing %s: ", shortname);
|
||||||
|
|
||||||
PyUnicode_AppendAndDel(&message,
|
PyUnicode_AppendAndDel(&message,
|
||||||
PyUnicode_FromWideChar(
|
PyUnicode_FromWideChar(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue