diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h index 8350fbf985..5d0a3c93cd 100644 --- a/Python/clinic/sysmodule.c.h +++ b/Python/clinic/sysmodule.c.h @@ -114,6 +114,54 @@ PyDoc_STRVAR(sys_unraisablehook__doc__, #define SYS_UNRAISABLEHOOK_METHODDEF \ {"unraisablehook", (PyCFunction)sys_unraisablehook, METH_O, sys_unraisablehook__doc__}, +PyDoc_STRVAR(sys__callonearg__doc__, +"_callonearg($module, func, arg, /)\n" +"--\n" +"\n" +"Wrapper."); + +#define SYS__CALLONEARG_METHODDEF \ + {"_callonearg", (PyCFunction)(void(*)(void))sys__callonearg, METH_FASTCALL, sys__callonearg__doc__}, + +static PyObject * +sys__callonearg_impl(PyObject *module, PyObject *func, PyObject *arg); + +static PyObject * +sys__callonearg(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *func; + PyObject *arg; + + if (!_PyArg_CheckPositional("_callonearg", nargs, 2, 2)) { + goto exit; + } + func = args[0]; + arg = args[1]; + return_value = sys__callonearg_impl(module, func, arg); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys__callnoargs__doc__, +"_callnoargs($module, func, /)\n" +"--\n" +"\n" +"Wrapper."); + +#define SYS__CALLNOARGS_METHODDEF \ + {"_callnoargs", (PyCFunction)sys__callnoargs, METH_O, sys__callnoargs__doc__}, + +PyDoc_STRVAR(sys__callnoargs_inline__doc__, +"_callnoargs_inline($module, func, /)\n" +"--\n" +"\n" +"Wrapper."); + +#define SYS__CALLNOARGS_INLINE_METHODDEF \ + {"_callnoargs_inline", (PyCFunction)sys__callnoargs_inline, METH_O, sys__callnoargs_inline__doc__}, + PyDoc_STRVAR(sys_exit__doc__, "exit($module, status=None, /)\n" "--\n" @@ -992,4 +1040,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored)) #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF #define SYS_GETANDROIDAPILEVEL_METHODDEF #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ -/*[clinic end generated code: output=855fc93b2347710b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=9bef63ce3c6ea1c4 input=a9049054013a1b77]*/ diff --git a/Python/sysmodule.c b/Python/sysmodule.c index ae3cbf1954..3f2f4f7890 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -822,6 +822,58 @@ sys_unraisablehook(PyObject *module, PyObject *unraisable) } +/*[clinic input] +sys._callonearg + + func: object + arg: object + / + +Wrapper. +[clinic start generated code]*/ + +static PyObject * +sys__callonearg_impl(PyObject *module, PyObject *func, PyObject *arg) +/*[clinic end generated code: output=7bb11bd7e01787e7 input=ebf68435f76708a1]*/ +{ + return PyObject_CallOneArg(func, arg); +} + + +/*[clinic input] +sys._callnoargs + + func: object + / + +Wrapper. +[clinic start generated code]*/ + +static PyObject * +sys__callnoargs(PyObject *module, PyObject *func) +/*[clinic end generated code: output=7312d6d8c815bd50 input=9202122dda810b68]*/ +{ + return PyObject_CallNoArgs(func); +} + + +/*[clinic input] +sys._callnoargs_inline + + func: object + / + +Wrapper. +[clinic start generated code]*/ + +static PyObject * +sys__callnoargs_inline(PyObject *module, PyObject *func) +/*[clinic end generated code: output=2d62eda5cc0c2eb7 input=635e078cc6f85d0d]*/ +{ + return _PyObject_CallNoArgs(func); +} + + /*[clinic input] sys.exit @@ -2023,6 +2075,9 @@ static PyMethodDef sys_methods[] = { SYS_GET_ASYNCGEN_HOOKS_METHODDEF SYS_GETANDROIDAPILEVEL_METHODDEF SYS_UNRAISABLEHOOK_METHODDEF + SYS__CALLONEARG_METHODDEF + SYS__CALLNOARGS_METHODDEF + SYS__CALLNOARGS_INLINE_METHODDEF {NULL, NULL} /* sentinel */ };