Skip to content

Commit 06d511d

Browse files
committed
added PyErr_SetInterrupt(); NT ifdefs
1 parent 575d561 commit 06d511d

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎Modules/signalmodule.c‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ PySignal_CDefaultIntHandler(self, arg)
9191
return (PyObject *)NULL;
9292
}
9393

94+
void
95+
PyErr_SetInterrupt()
96+
{
97+
PySignal_IsTripped++;
98+
PySignal_SignalHandlerArray[SIGINT].tripped = 1;
99+
}
100+
94101
static RETSIGTYPE
95102
PySignal_Handler(sig_num)
96103
int sig_num;
@@ -115,8 +122,9 @@ PySignal_Handler(sig_num)
115122
#endif
116123
(void *)signal(sig_num, &PySignal_Handler);
117124
}
118-
119125

126+
127+
#ifndef DONT_HAVE_SIG_ALARM
120128
static PyObject *
121129
PySignal_Alarm(self, args)
122130
PyObject *self; /* Not used */
@@ -128,7 +136,9 @@ PySignal_Alarm(self, args)
128136
/* alarm() returns the number of seconds remaining */
129137
return PyInt_FromLong(alarm(t));
130138
}
139+
#endif
131140

141+
#ifndef DONT_HAVE_SIG_PAUSE
132142
static PyObject *
133143
PySignal_Pause(self, args)
134144
PyObject *self; /* Not used */
@@ -142,6 +152,7 @@ PySignal_Pause(self, args)
142152
Py_INCREF(Py_None);
143153
return Py_None;
144154
}
155+
#endif
145156

146157
static PyObject *
147158
PySignal_Signal(self, args)
@@ -210,10 +221,14 @@ PySignal_GetSignal(self, args)
210221
/* List of functions defined in the module */
211222

212223
static PyMethodDef PySignal_methods[] = {
224+
#ifndef DONT_HAVE_SIG_ALARM
213225
{"alarm", PySignal_Alarm},
226+
#endif
214227
{"signal", PySignal_Signal},
215228
{"getsignal", PySignal_GetSignal},
229+
#ifndef DONT_HAVE_SIG_PAUSE
216230
{"pause", PySignal_Pause},
231+
#endif
217232
{"default_int_handler", PySignal_CDefaultIntHandler},
218233
{NULL, NULL} /* sentinel */
219234
};

0 commit comments

Comments
 (0)