Skip to content

Commit b0689ae

Browse files
bpo-41146: Convert signal.default_int_handler() to Argument Clinic (GH-21197)
1 parent 545b54d commit b0689ae

File tree

2 files changed

+52
-9
lines changed

2 files changed

+52
-9
lines changed

Modules/clinic/signalmodule.c.h

Lines changed: 37 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/signalmodule.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,26 @@ itimer_retval(struct itimerval *iv)
189189
}
190190
#endif
191191

192+
/*[clinic input]
193+
signal.default_int_handler
194+
signalnum: int
195+
frame: object
196+
/
197+
198+
The default handler for SIGINT installed by Python.
199+
200+
It raises KeyboardInterrupt.
201+
[clinic start generated code]*/
202+
192203
static PyObject *
193-
signal_default_int_handler(PyObject *self, PyObject *args)
204+
signal_default_int_handler_impl(PyObject *module, int signalnum,
205+
PyObject *frame)
206+
/*[clinic end generated code: output=bb11c2eb115ace4e input=efcd4a56a207acfd]*/
194207
{
195208
PyErr_SetNone(PyExc_KeyboardInterrupt);
196209
return NULL;
197210
}
198211

199-
PyDoc_STRVAR(default_int_handler_doc,
200-
"default_int_handler(...)\n\
201-
\n\
202-
The default handler for SIGINT installed by Python.\n\
203-
It raises KeyboardInterrupt.");
204-
205212

206213
static int
207214
report_wakeup_write_error(void *data)
@@ -1297,7 +1304,7 @@ signal_pidfd_send_signal_impl(PyObject *module, int pidfd, int signalnum,
12971304
/* List of functions defined in the module -- some of the methoddefs are
12981305
defined to nothing if the corresponding C function is not available. */
12991306
static PyMethodDef signal_methods[] = {
1300-
{"default_int_handler", signal_default_int_handler, METH_VARARGS, default_int_handler_doc},
1307+
SIGNAL_DEFAULT_INT_HANDLER_METHODDEF
13011308
SIGNAL_ALARM_METHODDEF
13021309
SIGNAL_SETITIMER_METHODDEF
13031310
SIGNAL_GETITIMER_METHODDEF

0 commit comments

Comments
 (0)