File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ extern "C" {
14
14
15
15
#ifdef MS_WINDOWS
16
16
# ifndef SOCKET
17
- # error "<winsock2.h> must be included before this header"
17
+ # ifdef PYCORE_SIGNAL_REQUIRES_WINSOCK
18
+ # error "<winsock2.h> must be included before this header"
19
+ # endif
18
20
# endif
19
21
# ifndef HANDLE
20
22
# error "<windows.h> must be included before this header"
@@ -40,7 +42,7 @@ extern "C" {
40
42
# define Py_NSIG 64 // Use a reasonable default value
41
43
#endif
42
44
43
- #ifdef MS_WINDOWS
45
+ #if defined( MS_WINDOWS ) && defined( SOCKET )
44
46
# define INVALID_FD ((SOCKET)-1)
45
47
#else
46
48
# define INVALID_FD (-1)
@@ -57,7 +59,12 @@ struct _signals_runtime_state {
57
59
58
60
volatile struct {
59
61
#ifdef MS_WINDOWS
62
+ # ifdef SOCKET
60
63
SOCKET fd ;
64
+ # else
65
+ // <winsock2.h> wasn't included already, so we fake it.
66
+ int fd ;
67
+ # endif
61
68
#elif defined(__VXWORKS__ )
62
69
int fd ;
63
70
#else
Original file line number Diff line number Diff line change 3
3
4
4
/* XXX Signals should be recorded per thread, now we have thread state. */
5
5
6
+ #ifdef MS_WINDOWS
7
+ # if !defined(SOCKET ) && defined(Py_INTERNAL_SIGNAL_H )
8
+ # error "pycore_signal.h included without PYCORE_SIGNAL_REQUIRES_WINSOCK"
9
+ # endif
10
+ # define _PYCORE_SIGNAL_REQUIRES_WINSOCK
11
+ #endif
12
+
6
13
#include "Python.h"
7
14
#include "pycore_atomic.h" // _Py_atomic_int
8
15
#include "pycore_call.h" // _PyObject_Call()
You can’t perform that action at this time.
0 commit comments