Skip to content

Commit c3a3ad9

Browse files
jcfrdavidsansome
andcommitted
MinGW support: Add patches-win32/01-dynload_win.patch
This commit integrates changes originally added to the project as python-cmake-buildsystem/python-cmake-buildsystem@18d49757e (Mingw32 support, and add cmake options for disabling) Note that in more recent version of Python, this patch is obsoleted by the following commits: See python/cpython@589f89e2a (introduced in 3.3) Removed a Windows 9x trick used before LoadLibraryExW. Windows 9x has long been unsupported and the result of GetFullPathName was not even being used in the first place. See python/cpython@05f2d84ca (introduced in 3.9) bpo-28269: Replace strcasecmp with system function _stricmp. (pythonGH-13095) Co-authored-by: David Sansome <[email protected]>
1 parent 6028e7f commit c3a3ad9

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

Python/dynload_win.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,6 @@ const struct filedescr _PyImport_DynLoadFiletab[] = {
2525
};
2626

2727

28-
/* Case insensitive string compare, to avoid any dependencies on particular
29-
C RTL implementations */
30-
31-
static int strcasecmp (char *string1, char *string2)
32-
{
33-
int first, second;
34-
35-
do {
36-
first = tolower(*string1);
37-
second = tolower(*string2);
38-
string1++;
39-
string2++;
40-
} while (first && first == second);
41-
42-
return (first - second);
43-
}
44-
45-
4628
/* Function to return the name of the "python" DLL that the supplied module
4729
directly imports. Looks through the list of imported modules and
4830
returns the first entry that starts with "python" (case sensitive) and
@@ -186,6 +168,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
186168
/* Don't display a message box when Python can't load a DLL */
187169
old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
188170

171+
#ifdef Py_ENABLE_SHARED
189172
if (GetFullPathName(pathname,
190173
sizeof(pathbuf),
191174
pathbuf,
@@ -196,6 +179,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
196179
LOAD_WITH_ALTERED_SEARCH_PATH);
197180
_Py_DeactivateActCtx(cookie);
198181
}
182+
#endif // Py_ENABLE_SHARED
199183

200184
/* restore old error mode settings */
201185
SetErrorMode(old_mode);

0 commit comments

Comments
 (0)