Skip to content

Commit d66ca37

Browse files
Move windows.h include out of internal/*.h.
1 parent e3b2b4b commit d66ca37

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

Include/internal/condvar.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
/* include windows if it hasn't been done before */
3434
#define WIN32_LEAN_AND_MEAN
35-
#include <windows.h>
3635

3736
/* options */
3837
/* non-emulated condition variables are provided for those that want
@@ -50,7 +49,7 @@
5049

5150
#if _PY_EMULATED_WIN_CV
5251

53-
typedef CRITICAL_SECTION PyMUTEX_T;
52+
typedef struct CRITICAL_SECTION PyMUTEX_T;
5453

5554
/* The ConditionVariable object. From XP onwards it is easily emulated
5655
with a Semaphore.
@@ -69,20 +68,16 @@ typedef CRITICAL_SECTION PyMUTEX_T;
6968
that would otherwise happen.
7069
*/
7170

72-
typedef struct _PyCOND_T
73-
{
74-
HANDLE sem;
75-
int waiting; /* to allow PyCOND_SIGNAL to be a no-op */
76-
} PyCOND_T;
71+
typedef struct _PyCOND_T PyCOND_T;
7772

7873
#else /* !_PY_EMULATED_WIN_CV */
7974

8075
/* Use native Win7 primitives if build target is Win7 or higher */
8176

8277
/* SRWLOCK is faster and better than CriticalSection */
83-
typedef SRWLOCK PyMUTEX_T;
78+
typedef struct SRWLOCK PyMUTEX_T;
8479

85-
typedef CONDITION_VARIABLE PyCOND_T;
80+
typedef struct CONDITION_VARIABLE PyCOND_T;
8681

8782
#endif /* _PY_EMULATED_WIN_CV */
8883

Include/pyport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);
641641
/* only get special linkage if built as shared or platform is Cygwin */
642642
#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__)
643643
# if defined(HAVE_DECLSPEC_DLL)
644-
# ifdef Py_BUILD_CORE
644+
# if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE)
645645
# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
646646
# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
647647
/* module init functions inside the core need no external linkage */
@@ -773,7 +773,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);
773773
#define PY_LITTLE_ENDIAN 1
774774
#endif
775775

776-
#ifdef Py_BUILD_CORE
776+
#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE)
777777
/*
778778
* Macros to protect CRT calls against instant termination when passed an
779779
* invalid parameter (issue23524).

PC/pyconfig.h

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -277,21 +277,20 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
277277

278278
/* For an MSVC DLL, we can nominate the .lib files used by extensions */
279279
#ifdef MS_COREDLL
280-
# ifndef Py_BUILD_CORE /* not building the core - must be an ext */
281-
# ifndef Py_BUILD_CORE_MODULE
282-
# if defined(_MSC_VER)
283-
/* So MSVC users need not specify the .lib
284-
file in their Makefile (other compilers are
285-
generally taken care of by distutils.) */
286-
# if defined(_DEBUG)
287-
# pragma comment(lib,"python37_d.lib")
288-
# elif defined(Py_LIMITED_API)
289-
# pragma comment(lib,"python3.lib")
290-
# else
291-
# pragma comment(lib,"python37.lib")
292-
# endif /* _DEBUG */
293-
# endif /* _MSC_VER */
294-
# endif /* Py_BUILD_CORE_MODULE */
280+
# if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
281+
/* not building the core - must be an ext */
282+
# if defined(_MSC_VER)
283+
/* So MSVC users need not specify the .lib
284+
file in their Makefile (other compilers are
285+
generally taken care of by distutils.) */
286+
# if defined(_DEBUG)
287+
# pragma comment(lib,"python37_d.lib")
288+
# elif defined(Py_LIMITED_API)
289+
# pragma comment(lib,"python3.lib")
290+
# else
291+
# pragma comment(lib,"python37.lib")
292+
# endif /* _DEBUG */
293+
# endif /* _MSC_VER */
295294
# endif /* Py_BUILD_CORE */
296295
#endif /* MS_COREDLL */
297296

Python/condvar.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us)
104104
* example native support on VISTA and onwards.
105105
*/
106106

107+
#include <windows.h>
108+
107109
#if _PY_EMULATED_WIN_CV
108110

109111
/* The mutex is a CriticalSection object and
@@ -121,6 +123,12 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us)
121123
http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
122124
*/
123125

126+
struct _PyCOND_T
127+
{
128+
HANDLE sem;
129+
int waiting; /* to allow PyCOND_SIGNAL to be a no-op */
130+
};
131+
124132
Py_LOCAL_INLINE(int)
125133
PyMUTEX_INIT(PyMUTEX_T *cs)
126134
{

0 commit comments

Comments
 (0)