]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044) (#131085)
authorVictor Stinner <vstinner@python.org>
Tue, 11 Mar 2025 11:55:13 +0000 (12:55 +0100)
committerGitHub <noreply@github.com>
Tue, 11 Mar 2025 11:55:13 +0000 (11:55 +0000)
gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044)

(cherry picked from commit de8818ae233b8e7722aa5d6f91d4b5a04bd039df)

Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
Include/internal/pycore_condvar.h
Modules/_io/winconsoleio.c
Python/sysmodule.c

index 981c962bf7dfdfa31fd774550394efc5702d74dc..2177bed31fcd27189e977ce51aba2a978704ce90 100644 (file)
 #define Py_HAVE_CONDVAR
 
 /* include windows if it hasn't been done before */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>              // CRITICAL_SECTION
 
 /* options */
 /* non-emulated condition variables are provided for those that want
index da4907ec2db2a87ffa70b6a482ad615a656dd0e0..164789ef218524676173e1623a558cf404d258d1 100644 (file)
@@ -23,7 +23,7 @@
 #include <stddef.h> /* For offsetof */
 
 #ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
 #endif
 #include <windows.h>
 #include <fcntl.h>
index e3bdff15a856bfe68d9cabcb74fe196fe64a557b..6ed28ec5fbd8bab6201abe1bb6d6c544da97e54f 100644 (file)
@@ -39,8 +39,10 @@ Data members:
 #include <locale.h>
 
 #ifdef MS_WINDOWS
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN
+#  endif
+#  include <windows.h>
 #endif /* MS_WINDOWS */
 
 #ifdef MS_COREDLL