diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-07-12 16:15:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-12 16:15:20 (GMT) |
commit | b0689ae7f9d904bc2126994aedbc552f03479e40 (patch) | |
tree | edf6ec4ca1fa1d1cb14313c71796c479974a1a3a /Modules/clinic | |
parent | 545b54d2abbc7970aa66b179a18ff2ac4440a8f9 (diff) | |
download | cpython-b0689ae7f9d904bc2126994aedbc552f03479e40.zip cpython-b0689ae7f9d904bc2126994aedbc552f03479e40.tar.gz cpython-b0689ae7f9d904bc2126994aedbc552f03479e40.tar.bz2 |
bpo-41146: Convert signal.default_int_handler() to Argument Clinic (GH-21197)
Diffstat (limited to 'Modules/clinic')
-rw-r--r-- | Modules/clinic/signalmodule.c.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h index 33a278e..4713bab 100644 --- a/Modules/clinic/signalmodule.c.h +++ b/Modules/clinic/signalmodule.c.h @@ -2,6 +2,42 @@ preserve [clinic start generated code]*/ +PyDoc_STRVAR(signal_default_int_handler__doc__, +"default_int_handler($module, signalnum, frame, /)\n" +"--\n" +"\n" +"The default handler for SIGINT installed by Python.\n" +"\n" +"It raises KeyboardInterrupt."); + +#define SIGNAL_DEFAULT_INT_HANDLER_METHODDEF \ + {"default_int_handler", (PyCFunction)(void(*)(void))signal_default_int_handler, METH_FASTCALL, signal_default_int_handler__doc__}, + +static PyObject * +signal_default_int_handler_impl(PyObject *module, int signalnum, + PyObject *frame); + +static PyObject * +signal_default_int_handler(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + int signalnum; + PyObject *frame; + + if (!_PyArg_CheckPositional("default_int_handler", nargs, 2, 2)) { + goto exit; + } + signalnum = _PyLong_AsInt(args[0]); + if (signalnum == -1 && PyErr_Occurred()) { + goto exit; + } + frame = args[1]; + return_value = signal_default_int_handler_impl(module, signalnum, frame); + +exit: + return return_value; +} + #if defined(HAVE_ALARM) PyDoc_STRVAR(signal_alarm__doc__, @@ -662,4 +698,4 @@ exit: #ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF #define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF #endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */ -/*[clinic end generated code: output=dff93c869101f043 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=59c33f0af42aebb5 input=a9049054013a1b77]*/ |