Skip to content
Permalink
Browse files

bpo-36965: Fix includes in main.c on Windows with non-MSC compilers (G…

…H-13421)

Include windows.h rather than crtdbg.h to get STATUS_CONTROL_C_EXIT constant.
Moreover, include windows.h on Windows, not only when MSC is used.
  • Loading branch information...
erikjanss authored and vstinner committed May 21, 2019
1 parent e7cb23b commit 925af1d99b69bf3e229411022ad840c5a0cfdcf8
Showing with 3 additions and 2 deletions.
  1. +1 −0 Misc/NEWS.d/next/Windows/2019-05-20-20-26-36.bpo-36965.KsfI-N.rst
  2. +2 −2 Modules/main.c
@@ -0,0 +1 @@
include of STATUS_CONTROL_C_EXIT without depending on MSC compiler
@@ -18,8 +18,8 @@
#if defined(HAVE_GETPID) && defined(HAVE_UNISTD_H)
# include <unistd.h> /* getpid() */
#endif
#ifdef _MSC_VER
# include <crtdbg.h> /* STATUS_CONTROL_C_EXIT */
#ifdef MS_WINDOWS
# include <windows.h> /* STATUS_CONTROL_C_EXIT */

This comment has been minimized.

Copy link
@eryksun

eryksun May 21, 2019

Contributor

"Windows.h" was already being included, as I mentioned on the issue tracker, because we certainly were not getting STATUS_CONTROL_C_EXIT from "crtdbg.h", a header that was left in this file accidentally about 12 years ago. If it's included explicitly here, also define WIN32_LEAN_AND_MEAN to cut the number of included headers by about a half.

#endif
/* End of includes for exit_sigint() */

0 comments on commit 925af1d

Please sign in to comment.
You can’t perform that action at this time.