Skip to content

Commit de8818a

Browse files
authored
gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044)
* Add missing guards for WIN32_LEAN_AND_MEAN * add missing whitespaces
1 parent 425e0af commit de8818a

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

Include/internal/pycore_condvar.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
#define Py_HAVE_CONDVAR
3232

3333
/* include windows if it hasn't been done before */
34-
#define WIN32_LEAN_AND_MEAN
34+
#ifndef WIN32_LEAN_AND_MEAN
35+
# define WIN32_LEAN_AND_MEAN
36+
#endif
3537
#include <windows.h> // CRITICAL_SECTION
3638

3739
/* options */

Include/internal/pycore_semaphore.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include "pycore_pythread.h" // _POSIX_SEMAPHORES
1111

1212
#ifdef MS_WINDOWS
13-
# define WIN32_LEAN_AND_MEAN
13+
# ifndef WIN32_LEAN_AND_MEAN
14+
# define WIN32_LEAN_AND_MEAN
15+
# endif
1416
# include <windows.h>
1517
#elif defined(HAVE_PTHREAD_H)
1618
# include <pthread.h>

Modules/_interpchannelsmodule.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include "pycore_pystate.h" // _PyInterpreterState_GetIDObject()
1212

1313
#ifdef MS_WINDOWS
14-
#define WIN32_LEAN_AND_MEAN
14+
#ifndef WIN32_LEAN_AND_MEAN
15+
# define WIN32_LEAN_AND_MEAN
16+
#endif
1517
#include <windows.h> // SwitchToThread()
1618
#elif defined(HAVE_SCHED_H)
1719
#include <sched.h> // sched_yield()

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/lock.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include "pycore_time.h" // _PyTime_Add()
99

1010
#ifdef MS_WINDOWS
11-
# define WIN32_LEAN_AND_MEAN
11+
# ifndef WIN32_LEAN_AND_MEAN
12+
# define WIN32_LEAN_AND_MEAN
13+
# endif
1214
# include <windows.h> // SwitchToThread()
1315
#elif defined(HAVE_SCHED_H)
1416
# include <sched.h> // sched_yield()

Python/sysmodule.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ Data members:
4545
#endif
4646

4747
#ifdef MS_WINDOWS
48-
# define WIN32_LEAN_AND_MEAN
48+
# ifndef WIN32_LEAN_AND_MEAN
49+
# define WIN32_LEAN_AND_MEAN
50+
# endif
4951
# include <windows.h>
5052
#endif /* MS_WINDOWS */
5153

0 commit comments

Comments
 (0)