Skip to content

bpo-41146: Convert signal.default_int_handler() to Argument Clinic #21197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion Modules/clinic/signalmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 15 additions & 8 deletions Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,26 @@ itimer_retval(struct itimerval *iv)
}
#endif

/*[clinic input]
signal.default_int_handler
signalnum: int
frame: object
/

The default handler for SIGINT installed by Python.

It raises KeyboardInterrupt.
[clinic start generated code]*/

static PyObject *
signal_default_int_handler(PyObject *self, PyObject *args)
signal_default_int_handler_impl(PyObject *module, int signalnum,
PyObject *frame)
/*[clinic end generated code: output=bb11c2eb115ace4e input=efcd4a56a207acfd]*/
{
PyErr_SetNone(PyExc_KeyboardInterrupt);
return NULL;
}

PyDoc_STRVAR(default_int_handler_doc,
"default_int_handler(...)\n\
\n\
The default handler for SIGINT installed by Python.\n\
It raises KeyboardInterrupt.");


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