MINGW-packages/mingw-w64-python/0076-Make-_Py_CheckPython3-extern.patch
2025-04-18 07:39:35 +02:00

39 lines
1.2 KiB
Diff

From 17921da9193739a39dc1af8fceb5bc34b752c3b4 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 076/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 | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index 26d6036..1f90e21 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -171,8 +171,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;
@@ -226,9 +225,9 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
dl_funcptr p;
char funcname[258], *import_python;
-#ifdef Py_ENABLE_SHARED
- _Py_CheckPython3();
-#endif /* Py_ENABLE_SHARED */
+#ifdef _MSC_VER
+ _Py_CheckPython3();
+#endif /* _MSC_VER */
wchar_t *wpathname = PyUnicode_AsWideCharString(pathname, NULL);
if (wpathname == NULL)