From 39d18d11bfcfae8173bf21d7f999ab7c770d65c8 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 17 Nov 2025 17:42:47 +0100 Subject: [PATCH 1/2] gh-141671: Use __declspec(dllexport) when not building core --- Include/exports.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/exports.h b/Include/exports.h index 62feb09ed2b433..73f0a1fca8102e 100644 --- a/Include/exports.h +++ b/Include/exports.h @@ -26,7 +26,7 @@ #endif #if defined(_WIN32) || defined(__CYGWIN__) - #if defined(Py_ENABLE_SHARED) + #if !defined(Py_BUILD_CORE) || defined(Py_ENABLE_SHARED) #define Py_IMPORTED_SYMBOL __declspec(dllimport) #define Py_EXPORTED_SYMBOL __declspec(dllexport) #define Py_LOCAL_SYMBOL From ad9110ca1c5d1a87dd0cb2bbdb8e24e396f8698f Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 17 Nov 2025 17:47:14 +0100 Subject: [PATCH 2/2] blurb --- .../next/C_API/2025-11-17-17-46-16.gh-issue-141671.cVXNW5.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/C_API/2025-11-17-17-46-16.gh-issue-141671.cVXNW5.rst diff --git a/Misc/NEWS.d/next/C_API/2025-11-17-17-46-16.gh-issue-141671.cVXNW5.rst b/Misc/NEWS.d/next/C_API/2025-11-17-17-46-16.gh-issue-141671.cVXNW5.rst new file mode 100644 index 00000000000000..5dd6913522ecc3 --- /dev/null +++ b/Misc/NEWS.d/next/C_API/2025-11-17-17-46-16.gh-issue-141671.cVXNW5.rst @@ -0,0 +1,2 @@ +:c:macro:`PyMODINIT_FUNC` (and the new :c:macro:`!PyMODEXPORT_FUNC`) now adds +a linkage declaration (``__declspec(dllexport)``) on Windows.