Skip to content

Commit b8ff9df

Browse files
Pull in HANDLE.
1 parent 391c0e2 commit b8ff9df

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Include/internal/pycore_signal.h

+13-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ extern "C" {
1313
#include "pycore_atomic.h" // _Py_atomic_address
1414

1515
#ifdef MS_WINDOWS
16-
# ifndef SOCKET
17-
# ifdef PYCORE_SIGNAL_REQUIRES_WINSOCK
16+
# ifdef PYCORE_SIGNAL_WITH_PRE_INCLUDES
17+
# ifndef SOCKET
1818
# error "<winsock2.h> must be included before this header"
1919
# endif
20-
# endif
21-
# ifndef HANDLE
22-
# error "<windows.h> must be included before this header"
20+
# ifndef HANDLE
21+
# error "<windows.h> must be included before this header"
22+
# endif
2323
# endif
2424
#endif
2525
#include <signal.h> // NSIG
@@ -62,7 +62,8 @@ struct _signals_runtime_state {
6262
# ifdef SOCKET
6363
SOCKET fd;
6464
# else
65-
// <winsock2.h> wasn't included already, so we fake it.
65+
// <winsock2.h> wasn't included already,
66+
// we use something compatible with SOCKET.
6667
int fd;
6768
# endif
6869
#elif defined(__VXWORKS__)
@@ -84,7 +85,13 @@ struct _signals_runtime_state {
8485
PyObject *default_handler;
8586
PyObject *ignore_handler;
8687
#ifdef MS_WINDOWS
88+
# ifdef HANDLE
8789
HANDLE sigint_event;
90+
# else
91+
// <windows.h> wasn't included already,
92+
// we use something compatible with HANDLE.
93+
void *sigint_event;
94+
# endif
8895
#endif
8996

9097
/* True if the main interpreter thread exited due to an unhandled

Modules/signalmodule.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
#ifdef MS_WINDOWS
77
# if !defined(SOCKET) && defined(Py_INTERNAL_SIGNAL_H)
8-
# error "pycore_signal.h included without PYCORE_SIGNAL_REQUIRES_WINSOCK"
8+
# error "pycore_signal.h included without PYCORE_SIGNAL_WITH_PRE_INCLUDES"
99
# endif
10-
# define _PYCORE_SIGNAL_REQUIRES_WINSOCK
10+
# define PYCORE_SIGNAL_WITH_PRE_INCLUDES
1111
#endif
1212

1313
#include "Python.h"

0 commit comments

Comments
 (0)