PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid)) {
+ pid = PyLong_AsPid(arg);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
return_value = os_sched_getscheduler_impl(module, pid);
int policy;
PyObject *param_obj;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "iO:sched_setscheduler",
- &pid, &policy, ¶m_obj)) {
+ if (!_PyArg_CheckPositional("sched_setscheduler", nargs, 3, 3)) {
goto exit;
}
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ policy = PyLong_AsInt(args[1]);
+ if (policy == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ param_obj = args[2];
return_value = os_sched_setscheduler_impl(module, pid, policy, param_obj);
exit:
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid)) {
+ pid = PyLong_AsPid(arg);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
return_value = os_sched_getparam_impl(module, pid);
pid_t pid;
PyObject *param_obj;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O:sched_setparam",
- &pid, ¶m_obj)) {
+ if (!_PyArg_CheckPositional("sched_setparam", nargs, 2, 2)) {
goto exit;
}
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ param_obj = args[1];
return_value = os_sched_setparam_impl(module, pid, param_obj);
exit:
pid_t pid;
double _return_value;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid)) {
+ pid = PyLong_AsPid(arg);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
_return_value = os_sched_rr_get_interval_impl(module, pid);
pid_t pid;
PyObject *mask;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O:sched_setaffinity",
- &pid, &mask)) {
+ if (!_PyArg_CheckPositional("sched_setaffinity", nargs, 2, 2)) {
+ goto exit;
+ }
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
+ mask = args[1];
return_value = os_sched_setaffinity_impl(module, pid, mask);
exit:
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid)) {
+ pid = PyLong_AsPid(arg);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
return_value = os_sched_getaffinity_impl(module, pid);
static const char * const _keywords[] = {"pid", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
- .format = "" _Py_PARSE_PID ":getpgid",
+ .fname = "getpgid",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
+ PyObject *argsbuf[1];
pid_t pid;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &pid)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
return_value = os_getpgid_impl(module, pid);
pid_t pid;
Py_ssize_t signal;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "n:kill",
- &pid, &signal)) {
+ if (!_PyArg_CheckPositional("kill", nargs, 2, 2)) {
+ goto exit;
+ }
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = _PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ signal = ival;
+ }
return_value = os_kill_impl(module, pid, signal);
exit:
pid_t pgid;
int signal;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "i:killpg",
- &pgid, &signal)) {
+ if (!_PyArg_CheckPositional("killpg", nargs, 2, 2)) {
+ goto exit;
+ }
+ pgid = PyLong_AsPid(args[0]);
+ if (pgid == (pid_t)(-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ signal = PyLong_AsInt(args[1]);
+ if (signal == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_killpg_impl(module, pgid, signal);
static const char * const _keywords[] = {"pid", "options", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
- .format = "" _Py_PARSE_PID "i:wait4",
+ .fname = "wait4",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
+ PyObject *argsbuf[2];
pid_t pid;
int options;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &pid, &options)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ options = PyLong_AsInt(args[1]);
+ if (options == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_wait4_impl(module, pid, options);
id_t id;
int options;
- if (!_PyArg_ParseStack(args, nargs, "i" _Py_PARSE_PID "i:waitid",
- &idtype, &id, &options)) {
+ if (!_PyArg_CheckPositional("waitid", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (!idtype_t_converter(args[0], &idtype)) {
+ goto exit;
+ }
+ id = (id_t)PyLong_AsPid(args[1]);
+ if (id == (id_t)(-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ options = PyLong_AsInt(args[2]);
+ if (options == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_waitid_impl(module, idtype, id, options);
pid_t pid;
int options;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "i:waitpid",
- &pid, &options)) {
+ if (!_PyArg_CheckPositional("waitpid", nargs, 2, 2)) {
+ goto exit;
+ }
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ options = PyLong_AsInt(args[1]);
+ if (options == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_waitpid_impl(module, pid, options);
intptr_t pid;
int options;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_INTPTR "i:waitpid",
- &pid, &options)) {
+ if (!_PyArg_CheckPositional("waitpid", nargs, 2, 2)) {
+ goto exit;
+ }
+ pid = (intptr_t)PyLong_AsVoidPtr(args[0]);
+ if (!pid && PyErr_Occurred()) {
+ goto exit;
+ }
+ options = PyLong_AsInt(args[1]);
+ if (options == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_waitpid_impl(module, pid, options);
static const char * const _keywords[] = {"pid", "flags", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
- .format = "" _Py_PARSE_PID "|O&:pidfd_open",
+ .fname = "pidfd_open",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
pid_t pid;
unsigned int flags = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &pid, _PyLong_UnsignedInt_Converter, &flags)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (!_PyLong_UnsignedInt_Converter(args[1], &flags)) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = os_pidfd_open_impl(module, pid, flags);
exit:
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid)) {
+ pid = PyLong_AsPid(arg);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
return_value = os_getsid_impl(module, pid);
pid_t pid;
pid_t pgrp;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid",
- &pid, &pgrp)) {
+ if (!_PyArg_CheckPositional("setpgid", nargs, 2, 2)) {
+ goto exit;
+ }
+ pid = PyLong_AsPid(args[0]);
+ if (pid == (pid_t)(-1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ pgrp = PyLong_AsPid(args[1]);
+ if (pgrp == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
return_value = os_setpgid_impl(module, pid, pgrp);
int fd;
pid_t pgid;
- if (!_PyArg_ParseStack(args, nargs, "i" _Py_PARSE_PID ":tcsetpgrp",
- &fd, &pgid)) {
+ if (!_PyArg_CheckPositional("tcsetpgrp", nargs, 2, 2)) {
+ goto exit;
+ }
+ fd = PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ pgid = PyLong_AsPid(args[1]);
+ if (pgid == (pid_t)(-1) && PyErr_Occurred()) {
goto exit;
}
return_value = os_tcsetpgrp_impl(module, fd, pgid);
intptr_t handle;
int _return_value;
- if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle)) {
+ handle = (intptr_t)PyLong_AsVoidPtr(arg);
+ if (!handle && PyErr_Occurred()) {
goto exit;
}
_return_value = os_get_handle_inheritable_impl(module, handle);
intptr_t handle;
int inheritable;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_INTPTR "p:set_handle_inheritable",
- &handle, &inheritable)) {
+ if (!_PyArg_CheckPositional("set_handle_inheritable", nargs, 2, 2)) {
+ goto exit;
+ }
+ handle = (intptr_t)PyLong_AsVoidPtr(args[0]);
+ if (!handle && PyErr_Occurred()) {
+ goto exit;
+ }
+ inheritable = PyObject_IsTrue(args[1]);
+ if (inheritable < 0) {
goto exit;
}
return_value = os_set_handle_inheritable_impl(module, handle, inheritable);
#ifndef OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
#define OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
#endif /* !defined(OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF) */
-/*[clinic end generated code: output=18d75b737513dae6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9756767bdbdabe94 input=a9049054013a1b77]*/