diff -r 1c5e0dbcb2a0 Doc/library/os.rst --- a/Doc/library/os.rst Sun Sep 25 16:54:17 2016 +0300 +++ b/Doc/library/os.rst Sun Sep 25 18:41:08 2016 +0200 @@ -3506,7 +3506,7 @@ .. versionadded:: 3.3 -.. function:: waitpid(pid, options) +.. function:: waitpid(pid, options=0) The details of this function differ on Unix and Windows. diff -r 1c5e0dbcb2a0 Modules/clinic/posixmodule.c.h --- a/Modules/clinic/posixmodule.c.h Sun Sep 25 16:54:17 2016 +0300 +++ b/Modules/clinic/posixmodule.c.h Sun Sep 25 18:41:08 2016 +0200 @@ -2963,7 +2963,7 @@ #if defined(HAVE_WAITPID) PyDoc_STRVAR(os_waitpid__doc__, -"waitpid($module, pid, options, /)\n" +"waitpid($module, /, pid, options=0)\n" "--\n" "\n" "Wait for completion of a given child process.\n" @@ -2974,19 +2974,21 @@ "The options argument is ignored on Windows."); #define OS_WAITPID_METHODDEF \ - {"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__}, + {"waitpid", (PyCFunction)os_waitpid, METH_FASTCALL, os_waitpid__doc__}, static PyObject * os_waitpid_impl(PyObject *module, pid_t pid, int options); static PyObject * -os_waitpid(PyObject *module, PyObject *args) +os_waitpid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; + static const char * const _keywords[] = {"pid", "options", NULL}; + static _PyArg_Parser _parser = {"" _Py_PARSE_PID "|i:waitpid", _keywords, 0}; pid_t pid; - int options; - - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:waitpid", + int options = 0; + + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, &pid, &options)) { goto exit; } @@ -3001,7 +3003,7 @@ #if defined(HAVE_CWAIT) PyDoc_STRVAR(os_waitpid__doc__, -"waitpid($module, pid, options, /)\n" +"waitpid($module, /, pid, options=0)\n" "--\n" "\n" "Wait for completion of a given process.\n" @@ -3012,19 +3014,21 @@ "The options argument is ignored on Windows."); #define OS_WAITPID_METHODDEF \ - {"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__}, + {"waitpid", (PyCFunction)os_waitpid, METH_FASTCALL, os_waitpid__doc__}, static PyObject * os_waitpid_impl(PyObject *module, intptr_t pid, int options); static PyObject * -os_waitpid(PyObject *module, PyObject *args) +os_waitpid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; + static const char * const _keywords[] = {"pid", "options", NULL}; + static _PyArg_Parser _parser = {"" _Py_PARSE_INTPTR "|i:waitpid", _keywords, 0}; intptr_t pid; - int options; - - if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "i:waitpid", + int options = 0; + + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, &pid, &options)) { goto exit; } @@ -6148,4 +6152,4 @@ #ifndef OS_GETRANDOM_METHODDEF #define OS_GETRANDOM_METHODDEF #endif /* !defined(OS_GETRANDOM_METHODDEF) */ -/*[clinic end generated code: output=b9ed5703d2feb0d9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=271dd33f2c82eb95 input=a9049054013a1b77]*/ diff -r 1c5e0dbcb2a0 Modules/posixmodule.c --- a/Modules/posixmodule.c Sun Sep 25 16:54:17 2016 +0300 +++ b/Modules/posixmodule.c Sun Sep 25 18:41:08 2016 +0200 @@ -6825,8 +6825,7 @@ /*[clinic input] os.waitpid pid: pid_t - options: int - / + options: int = 0 Wait for completion of a given child process. @@ -6838,7 +6837,7 @@ static PyObject * os_waitpid_impl(PyObject *module, pid_t pid, int options) -/*[clinic end generated code: output=5c37c06887a20270 input=0bf1666b8758fda3]*/ +/*[clinic end generated code: output=5c37c06887a20270 input=dea600de625eec93]*/ { pid_t res; int async_err = 0; @@ -6860,8 +6859,7 @@ /*[clinic input] os.waitpid pid: intptr_t - options: int - / + options: int = 0 Wait for completion of a given process. @@ -6873,7 +6871,7 @@ static PyObject * os_waitpid_impl(PyObject *module, intptr_t pid, int options) -/*[clinic end generated code: output=be836b221271d538 input=40f2440c515410f8]*/ +/*[clinic end generated code: output=be836b221271d538 input=ae2f154feb382cba]*/ { int status; intptr_t res;