Skip to content

Commit 3f226c5

Browse files
[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 de8818a) Co-authored-by: Max Bachmann <[email protected]>
1 parent bfad0b5 commit 3f226c5

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Include/internal/pycore_condvar.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
#define Py_HAVE_CONDVAR
3838

3939
/* include windows if it hasn't been done before */
40-
#define WIN32_LEAN_AND_MEAN
41-
#include <windows.h>
40+
#ifndef WIN32_LEAN_AND_MEAN
41+
# define WIN32_LEAN_AND_MEAN
42+
#endif
43+
#include <windows.h> // CRITICAL_SECTION
4244

4345
/* options */
4446
/* non-emulated condition variables are provided for those that want

Modules/_io/winconsoleio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <stddef.h> /* For offsetof */
2424

2525
#ifndef WIN32_LEAN_AND_MEAN
26-
#define WIN32_LEAN_AND_MEAN
26+
# define WIN32_LEAN_AND_MEAN
2727
#endif
2828
#include <windows.h>
2929
#include <fcntl.h>

Python/sysmodule.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ Data members:
3939
#include <locale.h>
4040

4141
#ifdef MS_WINDOWS
42-
#define WIN32_LEAN_AND_MEAN
43-
#include <windows.h>
42+
# ifndef WIN32_LEAN_AND_MEAN
43+
# define WIN32_LEAN_AND_MEAN
44+
# endif
45+
# include <windows.h>
4446
#endif /* MS_WINDOWS */
4547

4648
#ifdef MS_COREDLL

0 commit comments

Comments
 (0)