From: Victor Stinner Date: Tue, 11 Mar 2025 11:55:13 +0000 (+0100) Subject: [3.12] gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044) (#131085) X-Git-Tag: v3.12.10~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f226c5a7f776997b8bec4c7009b07c7bc93da94;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044) (#131085) gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044) (cherry picked from commit de8818ae233b8e7722aa5d6f91d4b5a04bd039df) Co-authored-by: Max Bachmann --- diff --git a/Include/internal/pycore_condvar.h b/Include/internal/pycore_condvar.h index 981c962bf7df..2177bed31fcd 100644 --- a/Include/internal/pycore_condvar.h +++ b/Include/internal/pycore_condvar.h @@ -37,8 +37,10 @@ #define Py_HAVE_CONDVAR /* include windows if it hasn't been done before */ -#define WIN32_LEAN_AND_MEAN -#include +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include // CRITICAL_SECTION /* options */ /* non-emulated condition variables are provided for those that want diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c index da4907ec2db2..164789ef2185 100644 --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -23,7 +23,7 @@ #include /* For offsetof */ #ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN #endif #include #include diff --git a/Python/sysmodule.c b/Python/sysmodule.c index e3bdff15a856..6ed28ec5fbd8 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -39,8 +39,10 @@ Data members: #include #ifdef MS_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include #endif /* MS_WINDOWS */ #ifdef MS_COREDLL