mirror of https://github.com/python/cpython
gh-94512: Fix forced arg format in posixmodule.c clinic code (#122516)
This commit is contained in:
parent
26d627779f
commit
f6cc7c8bd0
|
@ -4404,7 +4404,8 @@ os_sched_getscheduler(PyObject *module, PyObject *arg)
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
pid_t pid;
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_sched_getscheduler_impl(module, pid);
|
return_value = os_sched_getscheduler_impl(module, pid);
|
||||||
|
@ -4502,10 +4503,18 @@ os_sched_setscheduler(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
int policy;
|
int policy;
|
||||||
PyObject *param_obj;
|
PyObject *param_obj;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "iO:sched_setscheduler",
|
if (!_PyArg_CheckPositional("sched_setscheduler", nargs, 3, 3)) {
|
||||||
&pid, &policy, ¶m_obj)) {
|
|
||||||
goto exit;
|
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);
|
return_value = os_sched_setscheduler_impl(module, pid, policy, param_obj);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -4537,7 +4546,8 @@ os_sched_getparam(PyObject *module, PyObject *arg)
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
pid_t pid;
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_sched_getparam_impl(module, pid);
|
return_value = os_sched_getparam_impl(module, pid);
|
||||||
|
@ -4572,10 +4582,14 @@ os_sched_setparam(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
PyObject *param_obj;
|
PyObject *param_obj;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O:sched_setparam",
|
if (!_PyArg_CheckPositional("sched_setparam", nargs, 2, 2)) {
|
||||||
&pid, ¶m_obj)) {
|
|
||||||
goto exit;
|
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);
|
return_value = os_sched_setparam_impl(module, pid, param_obj);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -4607,7 +4621,8 @@ os_sched_rr_get_interval(PyObject *module, PyObject *arg)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
double _return_value;
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
_return_value = os_sched_rr_get_interval_impl(module, pid);
|
_return_value = os_sched_rr_get_interval_impl(module, pid);
|
||||||
|
@ -4667,10 +4682,14 @@ os_sched_setaffinity(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
PyObject *mask;
|
PyObject *mask;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O:sched_setaffinity",
|
if (!_PyArg_CheckPositional("sched_setaffinity", nargs, 2, 2)) {
|
||||||
&pid, &mask)) {
|
|
||||||
goto exit;
|
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);
|
return_value = os_sched_setaffinity_impl(module, pid, mask);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -4701,7 +4720,8 @@ os_sched_getaffinity(PyObject *module, PyObject *arg)
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
pid_t pid;
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_sched_getaffinity_impl(module, pid);
|
return_value = os_sched_getaffinity_impl(module, pid);
|
||||||
|
@ -5300,14 +5320,19 @@ os_getpgid(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
|
||||||
static const char * const _keywords[] = {"pid", NULL};
|
static const char * const _keywords[] = {"pid", NULL};
|
||||||
static _PyArg_Parser _parser = {
|
static _PyArg_Parser _parser = {
|
||||||
.keywords = _keywords,
|
.keywords = _keywords,
|
||||||
.format = "" _Py_PARSE_PID ":getpgid",
|
.fname = "getpgid",
|
||||||
.kwtuple = KWTUPLE,
|
.kwtuple = KWTUPLE,
|
||||||
};
|
};
|
||||||
#undef KWTUPLE
|
#undef KWTUPLE
|
||||||
|
PyObject *argsbuf[1];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
|
||||||
&pid)) {
|
if (!args) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
pid = PyLong_AsPid(args[0]);
|
||||||
|
if (pid == (pid_t)(-1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_getpgid_impl(module, pid);
|
return_value = os_getpgid_impl(module, pid);
|
||||||
|
@ -5452,10 +5477,25 @@ os_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
Py_ssize_t signal;
|
Py_ssize_t signal;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "n:kill",
|
if (!_PyArg_CheckPositional("kill", nargs, 2, 2)) {
|
||||||
&pid, &signal)) {
|
|
||||||
goto exit;
|
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);
|
return_value = os_kill_impl(module, pid, signal);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -5485,8 +5525,15 @@ os_killpg(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
pid_t pgid;
|
pid_t pgid;
|
||||||
int signal;
|
int signal;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "i:killpg",
|
if (!_PyArg_CheckPositional("killpg", nargs, 2, 2)) {
|
||||||
&pgid, &signal)) {
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_killpg_impl(module, pgid, signal);
|
return_value = os_killpg_impl(module, pgid, signal);
|
||||||
|
@ -5849,15 +5896,24 @@ os_wait4(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
|
||||||
static const char * const _keywords[] = {"pid", "options", NULL};
|
static const char * const _keywords[] = {"pid", "options", NULL};
|
||||||
static _PyArg_Parser _parser = {
|
static _PyArg_Parser _parser = {
|
||||||
.keywords = _keywords,
|
.keywords = _keywords,
|
||||||
.format = "" _Py_PARSE_PID "i:wait4",
|
.fname = "wait4",
|
||||||
.kwtuple = KWTUPLE,
|
.kwtuple = KWTUPLE,
|
||||||
};
|
};
|
||||||
#undef KWTUPLE
|
#undef KWTUPLE
|
||||||
|
PyObject *argsbuf[2];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int options;
|
int options;
|
||||||
|
|
||||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||||
&pid, &options)) {
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_wait4_impl(module, pid, options);
|
return_value = os_wait4_impl(module, pid, options);
|
||||||
|
@ -5901,8 +5957,18 @@ os_waitid(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
id_t id;
|
id_t id;
|
||||||
int options;
|
int options;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "i" _Py_PARSE_PID "i:waitid",
|
if (!_PyArg_CheckPositional("waitid", nargs, 3, 3)) {
|
||||||
&idtype, &id, &options)) {
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_waitid_impl(module, idtype, id, options);
|
return_value = os_waitid_impl(module, idtype, id, options);
|
||||||
|
@ -5939,8 +6005,15 @@ os_waitpid(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int options;
|
int options;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "i:waitpid",
|
if (!_PyArg_CheckPositional("waitpid", nargs, 2, 2)) {
|
||||||
&pid, &options)) {
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_waitpid_impl(module, pid, options);
|
return_value = os_waitpid_impl(module, pid, options);
|
||||||
|
@ -5977,8 +6050,15 @@ os_waitpid(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
intptr_t pid;
|
intptr_t pid;
|
||||||
int options;
|
int options;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_INTPTR "i:waitpid",
|
if (!_PyArg_CheckPositional("waitpid", nargs, 2, 2)) {
|
||||||
&pid, &options)) {
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_waitpid_impl(module, pid, options);
|
return_value = os_waitpid_impl(module, pid, options);
|
||||||
|
@ -6056,17 +6136,30 @@ os_pidfd_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
|
||||||
static const char * const _keywords[] = {"pid", "flags", NULL};
|
static const char * const _keywords[] = {"pid", "flags", NULL};
|
||||||
static _PyArg_Parser _parser = {
|
static _PyArg_Parser _parser = {
|
||||||
.keywords = _keywords,
|
.keywords = _keywords,
|
||||||
.format = "" _Py_PARSE_PID "|O&:pidfd_open",
|
.fname = "pidfd_open",
|
||||||
.kwtuple = KWTUPLE,
|
.kwtuple = KWTUPLE,
|
||||||
};
|
};
|
||||||
#undef KWTUPLE
|
#undef KWTUPLE
|
||||||
|
PyObject *argsbuf[2];
|
||||||
|
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
|
||||||
&pid, _PyLong_UnsignedInt_Converter, &flags)) {
|
if (!args) {
|
||||||
goto exit;
|
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);
|
return_value = os_pidfd_open_impl(module, pid, flags);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -6816,7 +6909,8 @@ os_getsid(PyObject *module, PyObject *arg)
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
pid_t pid;
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_getsid_impl(module, pid);
|
return_value = os_getsid_impl(module, pid);
|
||||||
|
@ -6870,8 +6964,15 @@ os_setpgid(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
pid_t pgrp;
|
pid_t pgrp;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid",
|
if (!_PyArg_CheckPositional("setpgid", nargs, 2, 2)) {
|
||||||
&pid, &pgrp)) {
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_setpgid_impl(module, pid, pgrp);
|
return_value = os_setpgid_impl(module, pid, pgrp);
|
||||||
|
@ -6935,8 +7036,15 @@ os_tcsetpgrp(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
||||||
int fd;
|
int fd;
|
||||||
pid_t pgid;
|
pid_t pgid;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "i" _Py_PARSE_PID ":tcsetpgrp",
|
if (!_PyArg_CheckPositional("tcsetpgrp", nargs, 2, 2)) {
|
||||||
&fd, &pgid)) {
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_tcsetpgrp_impl(module, fd, pgid);
|
return_value = os_tcsetpgrp_impl(module, fd, pgid);
|
||||||
|
@ -11318,7 +11426,8 @@ os_get_handle_inheritable(PyObject *module, PyObject *arg)
|
||||||
intptr_t handle;
|
intptr_t handle;
|
||||||
int _return_value;
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
_return_value = os_get_handle_inheritable_impl(module, handle);
|
_return_value = os_get_handle_inheritable_impl(module, handle);
|
||||||
|
@ -11355,8 +11464,15 @@ os_set_handle_inheritable(PyObject *module, PyObject *const *args, Py_ssize_t na
|
||||||
intptr_t handle;
|
intptr_t handle;
|
||||||
int inheritable;
|
int inheritable;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_INTPTR "p:set_handle_inheritable",
|
if (!_PyArg_CheckPositional("set_handle_inheritable", nargs, 2, 2)) {
|
||||||
&handle, &inheritable)) {
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = os_set_handle_inheritable_impl(module, handle, inheritable);
|
return_value = os_set_handle_inheritable_impl(module, handle, inheritable);
|
||||||
|
@ -12897,4 +13013,4 @@ os__create_environ(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
#ifndef OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
#ifndef OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
||||||
#define OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
#define OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
||||||
#endif /* !defined(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]*/
|
||||||
|
|
|
@ -1550,6 +1550,19 @@ dir_fd_and_follow_symlinks_invalid(const char *function_name, int dir_fd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_WAITID)
|
||||||
|
static int
|
||||||
|
idtype_t_converter(PyObject *arg, void *addr)
|
||||||
|
{
|
||||||
|
int value = PyLong_AsInt(arg);
|
||||||
|
if (value == -1 && PyErr_Occurred()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*((idtype_t *)addr) = (idtype_t)(value);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
typedef long long Py_off_t;
|
typedef long long Py_off_t;
|
||||||
#else
|
#else
|
||||||
|
@ -3054,17 +3067,42 @@ class pid_t_converter(CConverter):
|
||||||
type = 'pid_t'
|
type = 'pid_t'
|
||||||
format_unit = '" _Py_PARSE_PID "'
|
format_unit = '" _Py_PARSE_PID "'
|
||||||
|
|
||||||
class idtype_t_converter(int_converter):
|
def parse_arg(self, argname, displayname, *, limited_capi):
|
||||||
|
return self.format_code("""
|
||||||
|
{paramname} = PyLong_AsPid({argname});
|
||||||
|
if ({paramname} == (pid_t)(-1) && PyErr_Occurred()) {{{{
|
||||||
|
goto exit;
|
||||||
|
}}}}
|
||||||
|
""", argname=argname)
|
||||||
|
|
||||||
|
class idtype_t_converter(CConverter):
|
||||||
type = 'idtype_t'
|
type = 'idtype_t'
|
||||||
|
converter = 'idtype_t_converter'
|
||||||
|
|
||||||
class id_t_converter(CConverter):
|
class id_t_converter(CConverter):
|
||||||
type = 'id_t'
|
type = 'id_t'
|
||||||
format_unit = '" _Py_PARSE_PID "'
|
format_unit = '" _Py_PARSE_PID "'
|
||||||
|
|
||||||
|
def parse_arg(self, argname, displayname, *, limited_capi):
|
||||||
|
return self.format_code("""
|
||||||
|
{paramname} = (id_t)PyLong_AsPid({argname});
|
||||||
|
if ({paramname} == (id_t)(-1) && PyErr_Occurred()) {{{{
|
||||||
|
goto exit;
|
||||||
|
}}}}
|
||||||
|
""", argname=argname)
|
||||||
|
|
||||||
class intptr_t_converter(CConverter):
|
class intptr_t_converter(CConverter):
|
||||||
type = 'intptr_t'
|
type = 'intptr_t'
|
||||||
format_unit = '" _Py_PARSE_INTPTR "'
|
format_unit = '" _Py_PARSE_INTPTR "'
|
||||||
|
|
||||||
|
def parse_arg(self, argname, displayname, *, limited_capi):
|
||||||
|
return self.format_code("""
|
||||||
|
{paramname} = (intptr_t)PyLong_AsVoidPtr({argname});
|
||||||
|
if (!{paramname} && PyErr_Occurred()) {{{{
|
||||||
|
goto exit;
|
||||||
|
}}}}
|
||||||
|
""", argname=argname)
|
||||||
|
|
||||||
class Py_off_t_converter(CConverter):
|
class Py_off_t_converter(CConverter):
|
||||||
type = 'Py_off_t'
|
type = 'Py_off_t'
|
||||||
converter = 'Py_off_t_converter'
|
converter = 'Py_off_t_converter'
|
||||||
|
@ -3084,7 +3122,7 @@ class sysconf_confname_converter(path_confname_converter):
|
||||||
converter="conv_sysconf_confname"
|
converter="conv_sysconf_confname"
|
||||||
|
|
||||||
[python start generated code]*/
|
[python start generated code]*/
|
||||||
/*[python end generated code: output=da39a3ee5e6b4b0d input=577cb476e5d64960]*/
|
/*[python end generated code: output=da39a3ee5e6b4b0d input=1860d32584c2a539]*/
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue