summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/posixmodule.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic/posixmodule.c.h')
-rw-r--r--Modules/clinic/posixmodule.c.h527
1 files changed, 470 insertions, 57 deletions
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index e310d99..2c1ee97 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -1658,10 +1658,13 @@ os_execv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
path_t path = PATH_T_INITIALIZE("execv", "path", 0, 0);
PyObject *argv;
- if (!_PyArg_ParseStack(args, nargs, "O&O:execv",
- path_converter, &path, &argv)) {
+ if (!_PyArg_CheckPositional("execv", nargs, 2, 2)) {
goto exit;
}
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ argv = args[1];
return_value = os_execv_impl(module, &path, argv);
exit:
@@ -1817,10 +1820,22 @@ os_spawnv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
path_t path = PATH_T_INITIALIZE("spawnv", "path", 0, 0);
PyObject *argv;
- if (!_PyArg_ParseStack(args, nargs, "iO&O:spawnv",
- &mode, path_converter, &path, &argv)) {
+ if (!_PyArg_CheckPositional("spawnv", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[0]);
+ if (mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &path)) {
goto exit;
}
+ argv = args[2];
return_value = os_spawnv_impl(module, mode, &path, argv);
exit:
@@ -1865,10 +1880,23 @@ os_spawnve(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *argv;
PyObject *env;
- if (!_PyArg_ParseStack(args, nargs, "iO&OO:spawnve",
- &mode, path_converter, &path, &argv, &env)) {
+ if (!_PyArg_CheckPositional("spawnve", nargs, 4, 4)) {
goto exit;
}
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[0]);
+ if (mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &path)) {
+ goto exit;
+ }
+ argv = args[2];
+ env = args[3];
return_value = os_spawnve_impl(module, mode, &path, argv, env);
exit:
@@ -2874,8 +2902,13 @@ os_setreuid(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
uid_t ruid;
uid_t euid;
- if (!_PyArg_ParseStack(args, nargs, "O&O&:setreuid",
- _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) {
+ if (!_PyArg_CheckPositional("setreuid", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!_Py_Uid_Converter(args[0], &ruid)) {
+ goto exit;
+ }
+ if (!_Py_Uid_Converter(args[1], &euid)) {
goto exit;
}
return_value = os_setreuid_impl(module, ruid, euid);
@@ -2907,8 +2940,13 @@ os_setregid(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
gid_t rgid;
gid_t egid;
- if (!_PyArg_ParseStack(args, nargs, "O&O&:setregid",
- _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) {
+ if (!_PyArg_CheckPositional("setregid", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!_Py_Gid_Converter(args[0], &rgid)) {
+ goto exit;
+ }
+ if (!_Py_Gid_Converter(args[1], &egid)) {
goto exit;
}
return_value = os_setregid_impl(module, rgid, egid);
@@ -3558,8 +3596,25 @@ os_closerange(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int fd_low;
int fd_high;
- if (!_PyArg_ParseStack(args, nargs, "ii:closerange",
- &fd_low, &fd_high)) {
+ if (!_PyArg_CheckPositional("closerange", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd_low = _PyLong_AsInt(args[0]);
+ if (fd_low == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd_high = _PyLong_AsInt(args[1]);
+ if (fd_high == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_closerange_impl(module, fd_low, fd_high);
@@ -3672,8 +3727,28 @@ os_lockf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int command;
Py_off_t length;
- if (!_PyArg_ParseStack(args, nargs, "iiO&:lockf",
- &fd, &command, Py_off_t_converter, &length)) {
+ if (!_PyArg_CheckPositional("lockf", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ command = _PyLong_AsInt(args[1]);
+ if (command == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[2], &length)) {
goto exit;
}
return_value = os_lockf_impl(module, fd, command, length);
@@ -3708,8 +3783,28 @@ os_lseek(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int how;
Py_off_t _return_value;
- if (!_PyArg_ParseStack(args, nargs, "iO&i:lseek",
- &fd, Py_off_t_converter, &position, &how)) {
+ if (!_PyArg_CheckPositional("lseek", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[1], &position)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ how = _PyLong_AsInt(args[2]);
+ if (how == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_lseek_impl(module, fd, position, how);
@@ -3741,10 +3836,35 @@ os_read(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int fd;
Py_ssize_t length;
- if (!_PyArg_ParseStack(args, nargs, "in:read",
- &fd, &length)) {
+ if (!_PyArg_CheckPositional("read", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
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;
+ }
+ length = ival;
+ }
return_value = os_read_impl(module, fd, length);
exit:
@@ -3781,10 +3901,19 @@ os_readv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *buffers;
Py_ssize_t _return_value;
- if (!_PyArg_ParseStack(args, nargs, "iO:readv",
- &fd, &buffers)) {
+ if (!_PyArg_CheckPositional("readv", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
+ buffers = args[1];
_return_value = os_readv_impl(module, fd, buffers);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -3822,8 +3951,28 @@ os_pread(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int length;
Py_off_t offset;
- if (!_PyArg_ParseStack(args, nargs, "iiO&:pread",
- &fd, &length, Py_off_t_converter, &offset)) {
+ if (!_PyArg_CheckPositional("pread", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ length = _PyLong_AsInt(args[1]);
+ if (length == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[2], &offset)) {
goto exit;
}
return_value = os_pread_impl(module, fd, length, offset);
@@ -3873,10 +4022,35 @@ os_preadv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int flags = 0;
Py_ssize_t _return_value;
- if (!_PyArg_ParseStack(args, nargs, "iOO&|i:preadv",
- &fd, &buffers, Py_off_t_converter, &offset, &flags)) {
+ if (!_PyArg_CheckPositional("preadv", nargs, 3, 4)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ buffers = args[1];
+ if (!Py_off_t_converter(args[2], &offset)) {
goto exit;
}
+ if (nargs < 4) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[3])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(args[3]);
+ if (flags == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional:
_return_value = os_preadv_impl(module, fd, buffers, offset, flags);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -3909,8 +4083,23 @@ os_write(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Py_buffer data = {NULL, NULL};
Py_ssize_t _return_value;
- if (!_PyArg_ParseStack(args, nargs, "iy*:write",
- &fd, &data)) {
+ if (!_PyArg_CheckPositional("write", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[1], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("write", 2, "contiguous buffer", args[1]);
goto exit;
}
_return_value = os_write_impl(module, fd, &data);
@@ -3950,8 +4139,34 @@ os__fcopyfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int outfd;
int flags;
- if (!_PyArg_ParseStack(args, nargs, "iii:_fcopyfile",
- &infd, &outfd, &flags)) {
+ if (!_PyArg_CheckPositional("_fcopyfile", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ infd = _PyLong_AsInt(args[0]);
+ if (infd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ outfd = _PyLong_AsInt(args[1]);
+ if (outfd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(args[2]);
+ if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os__fcopyfile_impl(module, infd, outfd, flags);
@@ -4129,10 +4344,19 @@ os_writev(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *buffers;
Py_ssize_t _return_value;
- if (!_PyArg_ParseStack(args, nargs, "iO:writev",
- &fd, &buffers)) {
+ if (!_PyArg_CheckPositional("writev", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ buffers = args[1];
_return_value = os_writev_impl(module, fd, buffers);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -4172,8 +4396,26 @@ os_pwrite(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Py_off_t offset;
Py_ssize_t _return_value;
- if (!_PyArg_ParseStack(args, nargs, "iy*O&:pwrite",
- &fd, &buffer, Py_off_t_converter, &offset)) {
+ if (!_PyArg_CheckPositional("pwrite", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("pwrite", 2, "contiguous buffer", args[1]);
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[2], &offset)) {
goto exit;
}
_return_value = os_pwrite_impl(module, fd, &buffer, offset);
@@ -4232,10 +4474,35 @@ os_pwritev(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int flags = 0;
Py_ssize_t _return_value;
- if (!_PyArg_ParseStack(args, nargs, "iOO&|i:pwritev",
- &fd, &buffers, Py_off_t_converter, &offset, &flags)) {
+ if (!_PyArg_CheckPositional("pwritev", nargs, 3, 4)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ buffers = args[1];
+ if (!Py_off_t_converter(args[2], &offset)) {
+ goto exit;
+ }
+ if (nargs < 4) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[3])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(args[3]);
+ if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
+skip_optional:
_return_value = os_pwritev_impl(module, fd, buffers, offset, flags);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -4439,8 +4706,25 @@ os_makedev(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int minor;
dev_t _return_value;
- if (!_PyArg_ParseStack(args, nargs, "ii:makedev",
- &major, &minor)) {
+ if (!_PyArg_CheckPositional("makedev", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ major = _PyLong_AsInt(args[0]);
+ if (major == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ minor = _PyLong_AsInt(args[1]);
+ if (minor == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_makedev_impl(module, major, minor);
@@ -4476,8 +4760,19 @@ os_ftruncate(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int fd;
Py_off_t length;
- if (!_PyArg_ParseStack(args, nargs, "iO&:ftruncate",
- &fd, Py_off_t_converter, &length)) {
+ if (!_PyArg_CheckPositional("ftruncate", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[1], &length)) {
goto exit;
}
return_value = os_ftruncate_impl(module, fd, length);
@@ -4555,8 +4850,22 @@ os_posix_fallocate(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Py_off_t offset;
Py_off_t length;
- if (!_PyArg_ParseStack(args, nargs, "iO&O&:posix_fallocate",
- &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) {
+ if (!_PyArg_CheckPositional("posix_fallocate", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[1], &offset)) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[2], &length)) {
goto exit;
}
return_value = os_posix_fallocate_impl(module, fd, offset, length);
@@ -4599,8 +4908,31 @@ os_posix_fadvise(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
Py_off_t length;
int advice;
- if (!_PyArg_ParseStack(args, nargs, "iO&O&i:posix_fadvise",
- &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice)) {
+ if (!_PyArg_CheckPositional("posix_fadvise", nargs, 4, 4)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[1], &offset)) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[2], &length)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[3])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ advice = _PyLong_AsInt(args[3]);
+ if (advice == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_posix_fadvise_impl(module, fd, offset, length, advice);
@@ -4632,10 +4964,25 @@ os_putenv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *name;
PyObject *value;
- if (!_PyArg_ParseStack(args, nargs, "UU:putenv",
- &name, &value)) {
+ if (!_PyArg_CheckPositional("putenv", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("putenv", 1, "str", args[0]);
+ goto exit;
+ }
+ if (PyUnicode_READY(args[0]) == -1) {
+ goto exit;
+ }
+ name = args[0];
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("putenv", 2, "str", args[1]);
+ goto exit;
+ }
+ if (PyUnicode_READY(args[1]) == -1) {
goto exit;
}
+ value = args[1];
return_value = os_putenv_impl(module, name, value);
exit:
@@ -4665,8 +5012,13 @@ os_putenv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *name = NULL;
PyObject *value = NULL;
- if (!_PyArg_ParseStack(args, nargs, "O&O&:putenv",
- PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) {
+ if (!_PyArg_CheckPositional("putenv", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!PyUnicode_FSConverter(args[0], &name)) {
+ goto exit;
+ }
+ if (!PyUnicode_FSConverter(args[1], &value)) {
goto exit;
}
return_value = os_putenv_impl(module, name, value);
@@ -5208,8 +5560,19 @@ os_fpathconf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int name;
long _return_value;
- if (!_PyArg_ParseStack(args, nargs, "iO&:fpathconf",
- &fd, conv_path_confname, &name)) {
+ if (!_PyArg_CheckPositional("fpathconf", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!conv_path_confname(args[1], &name)) {
goto exit;
}
_return_value = os_fpathconf_impl(module, fd, name);
@@ -5496,8 +5859,16 @@ os_setresuid(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
uid_t euid;
uid_t suid;
- if (!_PyArg_ParseStack(args, nargs, "O&O&O&:setresuid",
- _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) {
+ if (!_PyArg_CheckPositional("setresuid", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (!_Py_Uid_Converter(args[0], &ruid)) {
+ goto exit;
+ }
+ if (!_Py_Uid_Converter(args[1], &euid)) {
+ goto exit;
+ }
+ if (!_Py_Uid_Converter(args[2], &suid)) {
goto exit;
}
return_value = os_setresuid_impl(module, ruid, euid, suid);
@@ -5530,8 +5901,16 @@ os_setresgid(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
gid_t egid;
gid_t sgid;
- if (!_PyArg_ParseStack(args, nargs, "O&O&O&:setresgid",
- _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) {
+ if (!_PyArg_CheckPositional("setresgid", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (!_Py_Gid_Converter(args[0], &rgid)) {
+ goto exit;
+ }
+ if (!_Py_Gid_Converter(args[1], &egid)) {
+ goto exit;
+ }
+ if (!_Py_Gid_Converter(args[2], &sgid)) {
goto exit;
}
return_value = os_setresgid_impl(module, rgid, egid, sgid);
@@ -5898,8 +6277,25 @@ os_set_inheritable(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int fd;
int inheritable;
- if (!_PyArg_ParseStack(args, nargs, "ii:set_inheritable",
- &fd, &inheritable)) {
+ if (!_PyArg_CheckPositional("set_inheritable", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ inheritable = _PyLong_AsInt(args[1]);
+ if (inheritable == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_set_inheritable_impl(module, fd, inheritable);
@@ -6046,8 +6442,25 @@ os_set_blocking(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int fd;
int blocking;
- if (!_PyArg_ParseStack(args, nargs, "ii:set_blocking",
- &fd, &blocking)) {
+ if (!_PyArg_CheckPositional("set_blocking", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ blocking = _PyLong_AsInt(args[1]);
+ if (blocking == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_set_blocking_impl(module, fd, blocking);
@@ -6845,4 +7258,4 @@ exit:
#ifndef OS_GETRANDOM_METHODDEF
#define OS_GETRANDOM_METHODDEF
#endif /* !defined(OS_GETRANDOM_METHODDEF) */
-/*[clinic end generated code: output=b02036b2a269b1db input=a9049054013a1b77]*/
+/*[clinic end generated code: output=febc1e16c9024e40 input=a9049054013a1b77]*/