MINGW-packages/mingw-w64-python/0116-Make-_Py_CheckPython3-extern.patch

37 lines
1.1 KiB
Diff

From 11fcbacb36ae16c499694956c7d2f57f0127edc8 Mon Sep 17 00:00:00 2001
From: Naveen M K <naveen521kk@gmail.com>
Date: Sun, 18 Jun 2023 13:17:48 +0530
Subject: [PATCH 116/N] Make `_Py_CheckPython3` extern
it's declared in headers but defined as static here, remove it
also run `_Py_CheckPython3` only when using MSVC
---
Python/dynload_win.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index efc18ff..79b60be 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -170,8 +170,7 @@ static char *GetPythonImport (HINSTANCE hModule)
Return whether the DLL was found.
*/
extern HMODULE PyWin_DLLhModule;
-static int
-_Py_CheckPython3(void)
+int _Py_CheckPython3(void)
{
static int python3_checked = 0;
static HANDLE hPython3;
@@ -224,7 +223,9 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
dl_funcptr p;
char funcname[258], *import_python;
- _Py_CheckPython3();
+#ifdef _MSC_VER
+ _Py_CheckPython3();
+#endif
#if USE_UNICODE_WCHAR_CACHE
const wchar_t *wpathname = _PyUnicode_AsUnicode(pathname);