Skip to content

Commit fc1bf87

Browse files
bpo-30860: Move windows.h include out of internal/*.h. (#3458)
PR #3397 introduced a large number of warnings to the Windows build. This patch fixes them.
1 parent 8728018 commit fc1bf87

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

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_BUILTIN)
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_BUILTIN)
777777
/*
778778
* Macros to protect CRT calls against instant termination when passed an
779779
* invalid parameter (issue23524).

Modules/_json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/* Core extension modules are built-in on some platforms (e.g. Windows). */
33
#ifdef Py_BUILD_CORE
4-
#define Py_BUILD_CORE_MODULE
4+
#define Py_BUILD_CORE_BUILTIN
55
#undef Py_BUILD_CORE
66
#endif
77

Modules/_pickle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/* Core extension modules are built-in on some platforms (e.g. Windows). */
33
#ifdef Py_BUILD_CORE
4-
#define Py_BUILD_CORE_MODULE
4+
#define Py_BUILD_CORE_BUILTIN
55
#undef Py_BUILD_CORE
66
#endif
77

PC/pyconfig.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ WIN32 is still required for the locale module.
143143
structures etc so it can optionally use new Windows features if it
144144
determines at runtime they are available.
145145
*/
146-
#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE)
146+
#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_BUILTIN) || defined(Py_BUILD_CORE_MODULE)
147147
#ifndef NTDDI_VERSION
148148
#define NTDDI_VERSION Py_NTDDI
149149
#endif
@@ -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_BUILTIN)
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

0 commit comments

Comments
 (0)