]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-88267: Avoid DLL exporting functions from static builds on Windows(GH-99888)
authorChristian Rendina <christian.rendina@gmail.com>
Fri, 9 Dec 2022 11:16:15 +0000 (12:16 +0100)
committerGitHub <noreply@github.com>
Fri, 9 Dec 2022 11:16:15 +0000 (11:16 +0000)
Include/exports.h
Misc/NEWS.d/next/Build/2022-12-08-14-00-04.gh-issue-88267.MqtRbm.rst [new file with mode: 0644]

index fc1a5c5ead6276e856de8e07080a125375a8acd0..59373c39ff757c07f89bebb9c499d8a2ba3d4c6b 100644 (file)
@@ -2,9 +2,15 @@
 #define Py_EXPORTS_H
 
 #if defined(_WIN32) || defined(__CYGWIN__)
-    #define Py_IMPORTED_SYMBOL __declspec(dllimport)
-    #define Py_EXPORTED_SYMBOL __declspec(dllexport)
-    #define Py_LOCAL_SYMBOL
+    #if defined(Py_ENABLE_SHARED)
+        #define Py_IMPORTED_SYMBOL __declspec(dllimport)
+        #define Py_EXPORTED_SYMBOL __declspec(dllexport)
+        #define Py_LOCAL_SYMBOL
+    #else
+        #define Py_IMPORTED_SYMBOL
+        #define Py_EXPORTED_SYMBOL
+        #define Py_LOCAL_SYMBOL
+    #endif
 #else
 /*
  * If we only ever used gcc >= 5, we could use __has_attribute(visibility)
diff --git a/Misc/NEWS.d/next/Build/2022-12-08-14-00-04.gh-issue-88267.MqtRbm.rst b/Misc/NEWS.d/next/Build/2022-12-08-14-00-04.gh-issue-88267.MqtRbm.rst
new file mode 100644 (file)
index 0000000..29c3f5a
--- /dev/null
@@ -0,0 +1 @@
+Avoid exporting Python symbols in linked Windows applications when the core is built as static.