https://github.com/python/cpython/commit/de8818ae233b8e7722aa5d6f91d4b5a04bd039df
commit: de8818ae233b8e7722aa5d6f91d4b5a04bd039df
branch: main
author: Max Bachmann <kont...@maxbachmann.de>
committer: vstinner <vstin...@python.org>
date: 2025-03-11T12:33:01+01:00
summary:

gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044)

* Add missing guards for WIN32_LEAN_AND_MEAN

* add missing whitespaces

files:
M Include/internal/pycore_condvar.h
M Include/internal/pycore_semaphore.h
M Modules/_interpchannelsmodule.c
M Modules/_io/winconsoleio.c
M Python/lock.c
M Python/sysmodule.c

diff --git a/Include/internal/pycore_condvar.h 
b/Include/internal/pycore_condvar.h
index ee9533484e8048..55271f0a4116ba 100644
--- a/Include/internal/pycore_condvar.h
+++ b/Include/internal/pycore_condvar.h
@@ -31,7 +31,9 @@
 #define Py_HAVE_CONDVAR
 
 /* include windows if it hasn't been done before */
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
 #include <windows.h>              // CRITICAL_SECTION
 
 /* options */
diff --git a/Include/internal/pycore_semaphore.h 
b/Include/internal/pycore_semaphore.h
index ffcc6d80344d6e..269538384606ce 100644
--- a/Include/internal/pycore_semaphore.h
+++ b/Include/internal/pycore_semaphore.h
@@ -10,7 +10,9 @@
 #include "pycore_pythread.h"      // _POSIX_SEMAPHORES
 
 #ifdef MS_WINDOWS
-#   define WIN32_LEAN_AND_MEAN
+#   ifndef WIN32_LEAN_AND_MEAN
+#       define WIN32_LEAN_AND_MEAN
+#   endif
 #   include <windows.h>
 #elif defined(HAVE_PTHREAD_H)
 #   include <pthread.h>
diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c
index fc54277cdc0ba0..ae64037d56cac0 100644
--- a/Modules/_interpchannelsmodule.c
+++ b/Modules/_interpchannelsmodule.c
@@ -11,7 +11,9 @@
 #include "pycore_pystate.h"       // _PyInterpreterState_GetIDObject()
 
 #ifdef MS_WINDOWS
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
 #include <windows.h>        // SwitchToThread()
 #elif defined(HAVE_SCHED_H)
 #include <sched.h>          // sched_yield()
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 27c320ed073103..3f137fa1f54125 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -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>
diff --git a/Python/lock.c b/Python/lock.c
index 554c51d7780322..f2067ee2cd5f37 100644
--- a/Python/lock.c
+++ b/Python/lock.c
@@ -8,7 +8,9 @@
 #include "pycore_time.h"          // _PyTime_Add()
 
 #ifdef MS_WINDOWS
-#  define WIN32_LEAN_AND_MEAN
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN
+#  endif
 #  include <windows.h>            // SwitchToThread()
 #elif defined(HAVE_SCHED_H)
 #  include <sched.h>              // sched_yield()
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 8030bbbdeafd52..adaa5ee1c74aa5 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -45,7 +45,9 @@ Data members:
 #endif
 
 #ifdef MS_WINDOWS
-#  define WIN32_LEAN_AND_MEAN
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN
+#  endif
 #  include <windows.h>
 #endif /* MS_WINDOWS */
 

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to