Skip to content

Commit 5674be5

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 00164b4 commit 5674be5

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
@@ -27,24 +27,6 @@ const struct filedescr _PyImport_DynLoadFiletab[] = {
2727
};
2828

2929

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

175+
#ifdef Py_ENABLE_SHARED
193176
if (GetFullPathName(pathname,
194177
sizeof(pathbuf),
195178
pathbuf,
@@ -204,6 +187,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
204187
_Py_DeactivateActCtx(cookie);
205188
#endif
206189
}
190+
#endif // Py_ENABLE_SHARED
207191

208192
/* restore old error mode settings */
209193
SetErrorMode(old_mode);

0 commit comments

Comments
 (0)