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.h520
1 files changed, 358 insertions, 162 deletions
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index be2e5a6..c550b9d 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -42,8 +42,9 @@ os_stat(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&p:stat", _keywords,
- path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
+ path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) {
goto exit;
+ }
return_value = os_stat_impl(module, &path, dir_fd, follow_symlinks);
exit:
@@ -77,8 +78,9 @@ os_lstat(PyObject *module, PyObject *args, PyObject *kwargs)
int dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:lstat", _keywords,
- path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_lstat_impl(module, &path, dir_fd);
exit:
@@ -140,11 +142,13 @@ os_access(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|$O&pp:access", _keywords,
- path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks))
+ path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks)) {
goto exit;
+ }
_return_value = os_access_impl(module, &path, mode, dir_fd, effective_ids, follow_symlinks);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -178,11 +182,13 @@ os_ttyname(PyObject *module, PyObject *arg)
int fd;
char *_return_value;
- if (!PyArg_Parse(arg, "i:ttyname", &fd))
+ if (!PyArg_Parse(arg, "i:ttyname", &fd)) {
goto exit;
+ }
_return_value = os_ttyname_impl(module, fd);
- if (_return_value == NULL)
+ if (_return_value == NULL) {
goto exit;
+ }
return_value = PyUnicode_DecodeFSDefault(_return_value);
exit:
@@ -237,8 +243,9 @@ os_chdir(PyObject *module, PyObject *args, PyObject *kwargs)
path_t path = PATH_T_INITIALIZE("chdir", "path", 0, PATH_HAVE_FCHDIR);
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chdir", _keywords,
- path_converter, &path))
+ path_converter, &path)) {
goto exit;
+ }
return_value = os_chdir_impl(module, &path);
exit:
@@ -273,8 +280,9 @@ os_fchdir(PyObject *module, PyObject *args, PyObject *kwargs)
int fd;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fchdir", _keywords,
- fildes_converter, &fd))
+ fildes_converter, &fd)) {
goto exit;
+ }
return_value = os_fchdir_impl(module, fd);
exit:
@@ -327,8 +335,9 @@ os_chmod(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|$O&p:chmod", _keywords,
- path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
+ path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) {
goto exit;
+ }
return_value = os_chmod_impl(module, &path, mode, dir_fd, follow_symlinks);
exit:
@@ -363,8 +372,9 @@ os_fchmod(PyObject *module, PyObject *args, PyObject *kwargs)
int mode;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:fchmod", _keywords,
- &fd, &mode))
+ &fd, &mode)) {
goto exit;
+ }
return_value = os_fchmod_impl(module, fd, mode);
exit:
@@ -399,8 +409,9 @@ os_lchmod(PyObject *module, PyObject *args, PyObject *kwargs)
int mode;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i:lchmod", _keywords,
- path_converter, &path, &mode))
+ path_converter, &path, &mode)) {
goto exit;
+ }
return_value = os_lchmod_impl(module, &path, mode);
exit:
@@ -443,8 +454,9 @@ os_chflags(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&k|p:chflags", _keywords,
- path_converter, &path, &flags, &follow_symlinks))
+ path_converter, &path, &flags, &follow_symlinks)) {
goto exit;
+ }
return_value = os_chflags_impl(module, &path, flags, follow_symlinks);
exit:
@@ -482,8 +494,9 @@ os_lchflags(PyObject *module, PyObject *args, PyObject *kwargs)
unsigned long flags;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&k:lchflags", _keywords,
- path_converter, &path, &flags))
+ path_converter, &path, &flags)) {
goto exit;
+ }
return_value = os_lchflags_impl(module, &path, flags);
exit:
@@ -517,8 +530,9 @@ os_chroot(PyObject *module, PyObject *args, PyObject *kwargs)
path_t path = PATH_T_INITIALIZE("chroot", "path", 0, 0);
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chroot", _keywords,
- path_converter, &path))
+ path_converter, &path)) {
goto exit;
+ }
return_value = os_chroot_impl(module, &path);
exit:
@@ -552,8 +566,9 @@ os_fsync(PyObject *module, PyObject *args, PyObject *kwargs)
int fd;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fsync", _keywords,
- fildes_converter, &fd))
+ fildes_converter, &fd)) {
goto exit;
+ }
return_value = os_fsync_impl(module, fd);
exit:
@@ -606,8 +621,9 @@ os_fdatasync(PyObject *module, PyObject *args, PyObject *kwargs)
int fd;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fdatasync", _keywords,
- fildes_converter, &fd))
+ fildes_converter, &fd)) {
goto exit;
+ }
return_value = os_fdatasync_impl(module, fd);
exit:
@@ -667,8 +683,9 @@ os_chown(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&|$O&p:chown", _keywords,
- path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
+ path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) {
goto exit;
+ }
return_value = os_chown_impl(module, &path, uid, gid, dir_fd, follow_symlinks);
exit:
@@ -706,8 +723,9 @@ os_fchown(PyObject *module, PyObject *args, PyObject *kwargs)
gid_t gid;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iO&O&:fchown", _keywords,
- &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid))
+ &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) {
goto exit;
+ }
return_value = os_fchown_impl(module, fd, uid, gid);
exit:
@@ -743,8 +761,9 @@ os_lchown(PyObject *module, PyObject *args, PyObject *kwargs)
gid_t gid;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&:lchown", _keywords,
- path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid))
+ path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) {
goto exit;
+ }
return_value = os_lchown_impl(module, &path, uid, gid);
exit:
@@ -830,8 +849,9 @@ os_link(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&p:link", _keywords,
- path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks))
+ path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks)) {
goto exit;
+ }
return_value = os_link_impl(module, &src, &dst, src_dir_fd, dst_dir_fd, follow_symlinks);
exit:
@@ -876,8 +896,9 @@ os_listdir(PyObject *module, PyObject *args, PyObject *kwargs)
path_t path = PATH_T_INITIALIZE("listdir", "path", 1, PATH_HAVE_FDOPENDIR);
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", _keywords,
- path_converter, &path))
+ path_converter, &path)) {
goto exit;
+ }
return_value = os_listdir_impl(module, &path);
exit:
@@ -906,8 +927,9 @@ os__getfullpathname(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
path_t path = PATH_T_INITIALIZE("_getfullpathname", "path", 0, 0);
- if (!PyArg_Parse(arg, "O&:_getfullpathname", path_converter, &path))
+ if (!PyArg_Parse(arg, "O&:_getfullpathname", path_converter, &path)) {
goto exit;
+ }
return_value = os__getfullpathname_impl(module, &path);
exit:
@@ -939,8 +961,9 @@ os__getfinalpathname(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *path;
- if (!PyArg_Parse(arg, "U:_getfinalpathname", &path))
+ if (!PyArg_Parse(arg, "U:_getfinalpathname", &path)) {
goto exit;
+ }
return_value = os__getfinalpathname_impl(module, path);
exit:
@@ -968,8 +991,9 @@ os__isdir(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
path_t path = PATH_T_INITIALIZE("_isdir", "path", 0, 0);
- if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path))
+ if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path)) {
goto exit;
+ }
return_value = os__isdir_impl(module, &path);
exit:
@@ -1003,8 +1027,9 @@ os__getvolumepathname(PyObject *module, PyObject *args, PyObject *kwargs)
PyObject *path;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:_getvolumepathname", _keywords,
- &path))
+ &path)) {
goto exit;
+ }
return_value = os__getvolumepathname_impl(module, path);
exit:
@@ -1042,8 +1067,9 @@ os_mkdir(PyObject *module, PyObject *args, PyObject *kwargs)
int dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i$O&:mkdir", _keywords,
- path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_mkdir_impl(module, &path, mode, dir_fd);
exit:
@@ -1073,8 +1099,9 @@ os_nice(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int increment;
- if (!PyArg_Parse(arg, "i:nice", &increment))
+ if (!PyArg_Parse(arg, "i:nice", &increment)) {
goto exit;
+ }
return_value = os_nice_impl(module, increment);
exit:
@@ -1106,8 +1133,9 @@ os_getpriority(PyObject *module, PyObject *args, PyObject *kwargs)
int who;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:getpriority", _keywords,
- &which, &who))
+ &which, &who)) {
goto exit;
+ }
return_value = os_getpriority_impl(module, which, who);
exit:
@@ -1140,8 +1168,9 @@ os_setpriority(PyObject *module, PyObject *args, PyObject *kwargs)
int priority;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iii:setpriority", _keywords,
- &which, &who, &priority))
+ &which, &who, &priority)) {
goto exit;
+ }
return_value = os_setpriority_impl(module, which, who, priority);
exit:
@@ -1180,8 +1209,9 @@ os_rename(PyObject *module, PyObject *args, PyObject *kwargs)
int dst_dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&:rename", _keywords,
- path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd))
+ path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) {
goto exit;
+ }
return_value = os_rename_impl(module, &src, &dst, src_dir_fd, dst_dir_fd);
exit:
@@ -1223,8 +1253,9 @@ os_replace(PyObject *module, PyObject *args, PyObject *kwargs)
int dst_dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&:replace", _keywords,
- path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd))
+ path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) {
goto exit;
+ }
return_value = os_replace_impl(module, &src, &dst, src_dir_fd, dst_dir_fd);
exit:
@@ -1262,8 +1293,9 @@ os_rmdir(PyObject *module, PyObject *args, PyObject *kwargs)
int dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:rmdir", _keywords,
- path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_rmdir_impl(module, &path, dir_fd);
exit:
@@ -1296,11 +1328,13 @@ os_system(PyObject *module, PyObject *args, PyObject *kwargs)
long _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:system", _keywords,
- &command))
+ &command)) {
goto exit;
+ }
_return_value = os_system_impl(module, command);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -1332,11 +1366,13 @@ os_system(PyObject *module, PyObject *args, PyObject *kwargs)
long _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:system", _keywords,
- PyUnicode_FSConverter, &command))
+ PyUnicode_FSConverter, &command)) {
goto exit;
+ }
_return_value = os_system_impl(module, command);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -1366,8 +1402,9 @@ os_umask(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int mask;
- if (!PyArg_Parse(arg, "i:umask", &mask))
+ if (!PyArg_Parse(arg, "i:umask", &mask)) {
goto exit;
+ }
return_value = os_umask_impl(module, mask);
exit:
@@ -1400,8 +1437,9 @@ os_unlink(PyObject *module, PyObject *args, PyObject *kwargs)
int dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:unlink", _keywords,
- path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_unlink_impl(module, &path, dir_fd);
exit:
@@ -1437,8 +1475,9 @@ os_remove(PyObject *module, PyObject *args, PyObject *kwargs)
int dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:remove", _keywords,
- path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_remove_impl(module, &path, dir_fd);
exit:
@@ -1521,8 +1560,9 @@ os_utime(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|O$OO&p:utime", _keywords,
- path_converter, &path, &times, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
+ path_converter, &path, &times, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) {
goto exit;
+ }
return_value = os_utime_impl(module, &path, times, ns, dir_fd, follow_symlinks);
exit:
@@ -1552,8 +1592,9 @@ os__exit(PyObject *module, PyObject *args, PyObject *kwargs)
int status;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:_exit", _keywords,
- &status))
+ &status)) {
goto exit;
+ }
return_value = os__exit_impl(module, status);
exit:
@@ -1587,8 +1628,9 @@ os_execv(PyObject *module, PyObject *args)
PyObject *argv;
if (!PyArg_ParseTuple(args, "O&O:execv",
- PyUnicode_FSConverter, &path, &argv))
+ PyUnicode_FSConverter, &path, &argv)) {
goto exit;
+ }
return_value = os_execv_impl(module, path, argv);
exit:
@@ -1631,8 +1673,9 @@ os_execve(PyObject *module, PyObject *args, PyObject *kwargs)
PyObject *env;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&OO:execve", _keywords,
- path_converter, &path, &argv, &env))
+ path_converter, &path, &argv, &env)) {
goto exit;
+ }
return_value = os_execve_impl(module, &path, argv, env);
exit:
@@ -1674,8 +1717,9 @@ os_spawnv(PyObject *module, PyObject *args)
PyObject *argv;
if (!PyArg_ParseTuple(args, "iO&O:spawnv",
- &mode, PyUnicode_FSConverter, &path, &argv))
+ &mode, PyUnicode_FSConverter, &path, &argv)) {
goto exit;
+ }
return_value = os_spawnv_impl(module, mode, path, argv);
exit:
@@ -1721,8 +1765,9 @@ os_spawnve(PyObject *module, PyObject *args)
PyObject *env;
if (!PyArg_ParseTuple(args, "iO&OO:spawnve",
- &mode, PyUnicode_FSConverter, &path, &argv, &env))
+ &mode, PyUnicode_FSConverter, &path, &argv, &env)) {
goto exit;
+ }
return_value = os_spawnve_impl(module, mode, path, argv, env);
exit:
@@ -1804,8 +1849,9 @@ os_sched_get_priority_max(PyObject *module, PyObject *args, PyObject *kwargs)
int policy;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_max", _keywords,
- &policy))
+ &policy)) {
goto exit;
+ }
return_value = os_sched_get_priority_max_impl(module, policy);
exit:
@@ -1836,8 +1882,9 @@ os_sched_get_priority_min(PyObject *module, PyObject *args, PyObject *kwargs)
int policy;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_min", _keywords,
- &policy))
+ &policy)) {
goto exit;
+ }
return_value = os_sched_get_priority_min_impl(module, policy);
exit:
@@ -1868,8 +1915,9 @@ os_sched_getscheduler(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid)) {
goto exit;
+ }
return_value = os_sched_getscheduler_impl(module, pid);
exit:
@@ -1900,8 +1948,9 @@ os_sched_param(PyTypeObject *type, PyObject *args, PyObject *kwargs)
PyObject *sched_priority;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:sched_param", _keywords,
- &sched_priority))
+ &sched_priority)) {
goto exit;
+ }
return_value = os_sched_param_impl(type, sched_priority);
exit:
@@ -1937,8 +1986,9 @@ os_sched_setscheduler(PyObject *module, PyObject *args)
struct sched_param param;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "iO&:sched_setscheduler",
- &pid, &policy, convert_sched_param, &param))
+ &pid, &policy, convert_sched_param, &param)) {
goto exit;
+ }
return_value = os_sched_setscheduler_impl(module, pid, policy, &param);
exit:
@@ -1970,8 +2020,9 @@ os_sched_getparam(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid)) {
goto exit;
+ }
return_value = os_sched_getparam_impl(module, pid);
exit:
@@ -2006,8 +2057,9 @@ os_sched_setparam(PyObject *module, PyObject *args)
struct sched_param param;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O&:sched_setparam",
- &pid, convert_sched_param, &param))
+ &pid, convert_sched_param, &param)) {
goto exit;
+ }
return_value = os_sched_setparam_impl(module, pid, &param);
exit:
@@ -2039,11 +2091,13 @@ os_sched_rr_get_interval(PyObject *module, PyObject *arg)
pid_t pid;
double _return_value;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid)) {
goto exit;
+ }
_return_value = os_sched_rr_get_interval_impl(module, pid);
- if ((_return_value == -1.0) && PyErr_Occurred())
+ if ((_return_value == -1.0) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyFloat_FromDouble(_return_value);
exit:
@@ -2098,8 +2152,9 @@ os_sched_setaffinity(PyObject *module, PyObject *args)
PyObject *mask;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O:sched_setaffinity",
- &pid, &mask))
+ &pid, &mask)) {
goto exit;
+ }
return_value = os_sched_setaffinity_impl(module, pid, mask);
exit:
@@ -2114,7 +2169,7 @@ PyDoc_STRVAR(os_sched_getaffinity__doc__,
"sched_getaffinity($module, pid, /)\n"
"--\n"
"\n"
-"Return the affinity of the process identified by pid.\n"
+"Return the affinity of the process identified by pid (or the current process if zero).\n"
"\n"
"The affinity is returned as a set of CPU identifiers.");
@@ -2130,8 +2185,9 @@ os_sched_getaffinity(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid)) {
goto exit;
+ }
return_value = os_sched_getaffinity_impl(module, pid);
exit:
@@ -2320,8 +2376,9 @@ os_getpgid(PyObject *module, PyObject *args, PyObject *kwargs)
pid_t pid;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID ":getpgid", _keywords,
- &pid))
+ &pid)) {
goto exit;
+ }
return_value = os_getpgid_impl(module, pid);
exit:
@@ -2465,8 +2522,9 @@ os_kill(PyObject *module, PyObject *args)
Py_ssize_t signal;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "n:kill",
- &pid, &signal))
+ &pid, &signal)) {
goto exit;
+ }
return_value = os_kill_impl(module, pid, signal);
exit:
@@ -2497,8 +2555,9 @@ os_killpg(PyObject *module, PyObject *args)
int signal;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:killpg",
- &pgid, &signal))
+ &pgid, &signal)) {
goto exit;
+ }
return_value = os_killpg_impl(module, pgid, signal);
exit:
@@ -2527,8 +2586,9 @@ os_plock(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int op;
- if (!PyArg_Parse(arg, "i:plock", &op))
+ if (!PyArg_Parse(arg, "i:plock", &op)) {
goto exit;
+ }
return_value = os_plock_impl(module, op);
exit:
@@ -2557,8 +2617,9 @@ os_setuid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
uid_t uid;
- if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid))
+ if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid)) {
goto exit;
+ }
return_value = os_setuid_impl(module, uid);
exit:
@@ -2587,8 +2648,9 @@ os_seteuid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
uid_t euid;
- if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid))
+ if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid)) {
goto exit;
+ }
return_value = os_seteuid_impl(module, euid);
exit:
@@ -2617,8 +2679,9 @@ os_setegid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
gid_t egid;
- if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid))
+ if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid)) {
goto exit;
+ }
return_value = os_setegid_impl(module, egid);
exit:
@@ -2649,8 +2712,9 @@ os_setreuid(PyObject *module, PyObject *args)
uid_t euid;
if (!PyArg_ParseTuple(args, "O&O&:setreuid",
- _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid))
+ _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) {
goto exit;
+ }
return_value = os_setreuid_impl(module, ruid, euid);
exit:
@@ -2681,8 +2745,9 @@ os_setregid(PyObject *module, PyObject *args)
gid_t egid;
if (!PyArg_ParseTuple(args, "O&O&:setregid",
- _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid))
+ _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) {
goto exit;
+ }
return_value = os_setregid_impl(module, rgid, egid);
exit:
@@ -2711,8 +2776,9 @@ os_setgid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
gid_t gid;
- if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid))
+ if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid)) {
goto exit;
+ }
return_value = os_setgid_impl(module, gid);
exit:
@@ -2759,8 +2825,9 @@ os_wait3(PyObject *module, PyObject *args, PyObject *kwargs)
int options;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:wait3", _keywords,
- &options))
+ &options)) {
goto exit;
+ }
return_value = os_wait3_impl(module, options);
exit:
@@ -2795,8 +2862,9 @@ os_wait4(PyObject *module, PyObject *args, PyObject *kwargs)
int options;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID "i:wait4", _keywords,
- &pid, &options))
+ &pid, &options)) {
goto exit;
+ }
return_value = os_wait4_impl(module, pid, options);
exit:
@@ -2839,8 +2907,9 @@ os_waitid(PyObject *module, PyObject *args)
int options;
if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID "i:waitid",
- &idtype, &id, &options))
+ &idtype, &id, &options)) {
goto exit;
+ }
return_value = os_waitid_impl(module, idtype, id, options);
exit:
@@ -2876,8 +2945,9 @@ os_waitpid(PyObject *module, PyObject *args)
int options;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:waitpid",
- &pid, &options))
+ &pid, &options)) {
goto exit;
+ }
return_value = os_waitpid_impl(module, pid, options);
exit:
@@ -2913,8 +2983,9 @@ os_waitpid(PyObject *module, PyObject *args)
int options;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "i:waitpid",
- &pid, &options))
+ &pid, &options)) {
goto exit;
+ }
return_value = os_waitpid_impl(module, pid, options);
exit:
@@ -2984,8 +3055,9 @@ os_symlink(PyObject *module, PyObject *args, PyObject *kwargs)
int dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|p$O&:symlink", _keywords,
- path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_symlink_impl(module, &src, &dst, target_is_directory, dir_fd);
exit:
@@ -3045,8 +3117,9 @@ os_getsid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid)) {
goto exit;
+ }
return_value = os_getsid_impl(module, pid);
exit:
@@ -3099,8 +3172,9 @@ os_setpgid(PyObject *module, PyObject *args)
pid_t pgrp;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid",
- &pid, &pgrp))
+ &pid, &pgrp)) {
goto exit;
+ }
return_value = os_setpgid_impl(module, pid, pgrp);
exit:
@@ -3129,8 +3203,9 @@ os_tcgetpgrp(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd))
+ if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd)) {
goto exit;
+ }
return_value = os_tcgetpgrp_impl(module, fd);
exit:
@@ -3161,8 +3236,9 @@ os_tcsetpgrp(PyObject *module, PyObject *args)
pid_t pgid;
if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID ":tcsetpgrp",
- &fd, &pgid))
+ &fd, &pgid)) {
goto exit;
+ }
return_value = os_tcsetpgrp_impl(module, fd, pgid);
exit:
@@ -3200,11 +3276,13 @@ os_open(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|i$O&:open", _keywords,
- path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
_return_value = os_open_impl(module, &path, flags, mode, dir_fd);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -3234,8 +3312,9 @@ os_close(PyObject *module, PyObject *args, PyObject *kwargs)
int fd;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:close", _keywords,
- &fd))
+ &fd)) {
goto exit;
+ }
return_value = os_close_impl(module, fd);
exit:
@@ -3262,8 +3341,9 @@ os_closerange(PyObject *module, PyObject *args)
int fd_high;
if (!PyArg_ParseTuple(args, "ii:closerange",
- &fd_low, &fd_high))
+ &fd_low, &fd_high)) {
goto exit;
+ }
return_value = os_closerange_impl(module, fd_low, fd_high);
exit:
@@ -3289,11 +3369,13 @@ os_dup(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (!PyArg_Parse(arg, "i:dup", &fd))
+ if (!PyArg_Parse(arg, "i:dup", &fd)) {
goto exit;
+ }
_return_value = os_dup_impl(module, fd);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -3322,8 +3404,9 @@ os_dup2(PyObject *module, PyObject *args, PyObject *kwargs)
int inheritable = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|p:dup2", _keywords,
- &fd, &fd2, &inheritable))
+ &fd, &fd2, &inheritable)) {
goto exit;
+ }
return_value = os_dup2_impl(module, fd, fd2, inheritable);
exit:
@@ -3360,8 +3443,9 @@ os_lockf(PyObject *module, PyObject *args)
Py_off_t length;
if (!PyArg_ParseTuple(args, "iiO&:lockf",
- &fd, &command, Py_off_t_converter, &length))
+ &fd, &command, Py_off_t_converter, &length)) {
goto exit;
+ }
return_value = os_lockf_impl(module, fd, command, length);
exit:
@@ -3395,11 +3479,13 @@ os_lseek(PyObject *module, PyObject *args)
Py_off_t _return_value;
if (!PyArg_ParseTuple(args, "iO&i:lseek",
- &fd, Py_off_t_converter, &position, &how))
+ &fd, Py_off_t_converter, &position, &how)) {
goto exit;
+ }
_return_value = os_lseek_impl(module, fd, position, how);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromPy_off_t(_return_value);
exit:
@@ -3426,8 +3512,9 @@ os_read(PyObject *module, PyObject *args)
Py_ssize_t length;
if (!PyArg_ParseTuple(args, "in:read",
- &fd, &length))
+ &fd, &length)) {
goto exit;
+ }
return_value = os_read_impl(module, fd, length);
exit:
@@ -3465,11 +3552,13 @@ os_readv(PyObject *module, PyObject *args)
Py_ssize_t _return_value;
if (!PyArg_ParseTuple(args, "iO:readv",
- &fd, &buffers))
+ &fd, &buffers)) {
goto exit;
+ }
_return_value = os_readv_impl(module, fd, buffers);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -3504,8 +3593,9 @@ os_pread(PyObject *module, PyObject *args)
Py_off_t offset;
if (!PyArg_ParseTuple(args, "iiO&:pread",
- &fd, &length, Py_off_t_converter, &offset))
+ &fd, &length, Py_off_t_converter, &offset)) {
goto exit;
+ }
return_value = os_pread_impl(module, fd, length, offset);
exit:
@@ -3535,17 +3625,20 @@ os_write(PyObject *module, PyObject *args)
Py_ssize_t _return_value;
if (!PyArg_ParseTuple(args, "iy*:write",
- &fd, &data))
+ &fd, &data)) {
goto exit;
+ }
_return_value = os_write_impl(module, fd, &data);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -3573,8 +3666,9 @@ os_fstat(PyObject *module, PyObject *args, PyObject *kwargs)
int fd;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:fstat", _keywords,
- &fd))
+ &fd)) {
goto exit;
+ }
return_value = os_fstat_impl(module, fd);
exit:
@@ -3603,11 +3697,13 @@ os_isatty(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (!PyArg_Parse(arg, "i:isatty", &fd))
+ if (!PyArg_Parse(arg, "i:isatty", &fd)) {
goto exit;
+ }
_return_value = os_isatty_impl(module, fd);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -3665,8 +3761,9 @@ os_pipe2(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int flags;
- if (!PyArg_Parse(arg, "i:pipe2", &flags))
+ if (!PyArg_Parse(arg, "i:pipe2", &flags)) {
goto exit;
+ }
return_value = os_pipe2_impl(module, flags);
exit:
@@ -3701,11 +3798,13 @@ os_writev(PyObject *module, PyObject *args)
Py_ssize_t _return_value;
if (!PyArg_ParseTuple(args, "iO:writev",
- &fd, &buffers))
+ &fd, &buffers)) {
goto exit;
+ }
_return_value = os_writev_impl(module, fd, buffers);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -3742,17 +3841,20 @@ os_pwrite(PyObject *module, PyObject *args)
Py_ssize_t _return_value;
if (!PyArg_ParseTuple(args, "iy*O&:pwrite",
- &fd, &buffer, Py_off_t_converter, &offset))
+ &fd, &buffer, Py_off_t_converter, &offset)) {
goto exit;
+ }
_return_value = os_pwrite_impl(module, fd, &buffer, offset);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
/* Cleanup for buffer */
- if (buffer.obj)
+ if (buffer.obj) {
PyBuffer_Release(&buffer);
+ }
return return_value;
}
@@ -3788,8 +3890,9 @@ os_mkfifo(PyObject *module, PyObject *args, PyObject *kwargs)
int dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i$O&:mkfifo", _keywords,
- path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_mkfifo_impl(module, &path, mode, dir_fd);
exit:
@@ -3839,8 +3942,9 @@ os_mknod(PyObject *module, PyObject *args, PyObject *kwargs)
int dir_fd = DEFAULT_DIR_FD;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|iO&$O&:mknod", _keywords,
- path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd))
+ path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_mknod_impl(module, &path, mode, device, dir_fd);
exit:
@@ -3873,11 +3977,13 @@ os_major(PyObject *module, PyObject *arg)
dev_t device;
unsigned int _return_value;
- if (!PyArg_Parse(arg, "O&:major", _Py_Dev_Converter, &device))
+ if (!PyArg_Parse(arg, "O&:major", _Py_Dev_Converter, &device)) {
goto exit;
+ }
_return_value = os_major_impl(module, device);
- if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
@@ -3907,11 +4013,13 @@ os_minor(PyObject *module, PyObject *arg)
dev_t device;
unsigned int _return_value;
- if (!PyArg_Parse(arg, "O&:minor", _Py_Dev_Converter, &device))
+ if (!PyArg_Parse(arg, "O&:minor", _Py_Dev_Converter, &device)) {
goto exit;
+ }
_return_value = os_minor_impl(module, device);
- if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
@@ -3943,11 +4051,13 @@ os_makedev(PyObject *module, PyObject *args)
dev_t _return_value;
if (!PyArg_ParseTuple(args, "ii:makedev",
- &major, &minor))
+ &major, &minor)) {
goto exit;
+ }
_return_value = os_makedev_impl(module, major, minor);
- if ((_return_value == (dev_t)-1) && PyErr_Occurred())
+ if ((_return_value == (dev_t)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = _PyLong_FromDev(_return_value);
exit:
@@ -3978,8 +4088,9 @@ os_ftruncate(PyObject *module, PyObject *args)
Py_off_t length;
if (!PyArg_ParseTuple(args, "iO&:ftruncate",
- &fd, Py_off_t_converter, &length))
+ &fd, Py_off_t_converter, &length)) {
goto exit;
+ }
return_value = os_ftruncate_impl(module, fd, length);
exit:
@@ -4014,8 +4125,9 @@ os_truncate(PyObject *module, PyObject *args, PyObject *kwargs)
Py_off_t length;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:truncate", _keywords,
- path_converter, &path, Py_off_t_converter, &length))
+ path_converter, &path, Py_off_t_converter, &length)) {
goto exit;
+ }
return_value = os_truncate_impl(module, &path, length);
exit:
@@ -4054,8 +4166,9 @@ os_posix_fallocate(PyObject *module, PyObject *args)
Py_off_t length;
if (!PyArg_ParseTuple(args, "iO&O&:posix_fallocate",
- &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length))
+ &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) {
goto exit;
+ }
return_value = os_posix_fallocate_impl(module, fd, offset, length);
exit:
@@ -4097,8 +4210,9 @@ os_posix_fadvise(PyObject *module, PyObject *args)
int advice;
if (!PyArg_ParseTuple(args, "iO&O&i:posix_fadvise",
- &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice))
+ &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice)) {
goto exit;
+ }
return_value = os_posix_fadvise_impl(module, fd, offset, length, advice);
exit:
@@ -4129,8 +4243,9 @@ os_putenv(PyObject *module, PyObject *args)
PyObject *value;
if (!PyArg_ParseTuple(args, "UU:putenv",
- &name, &value))
+ &name, &value)) {
goto exit;
+ }
return_value = os_putenv_impl(module, name, value);
exit:
@@ -4161,8 +4276,9 @@ os_putenv(PyObject *module, PyObject *args)
PyObject *value = NULL;
if (!PyArg_ParseTuple(args, "O&O&:putenv",
- PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value))
+ PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) {
goto exit;
+ }
return_value = os_putenv_impl(module, name, value);
exit:
@@ -4196,8 +4312,9 @@ os_unsetenv(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *name = NULL;
- if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name))
+ if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name)) {
goto exit;
+ }
return_value = os_unsetenv_impl(module, name);
exit:
@@ -4227,8 +4344,9 @@ os_strerror(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int code;
- if (!PyArg_Parse(arg, "i:strerror", &code))
+ if (!PyArg_Parse(arg, "i:strerror", &code)) {
goto exit;
+ }
return_value = os_strerror_impl(module, code);
exit:
@@ -4256,11 +4374,13 @@ os_WCOREDUMP(PyObject *module, PyObject *arg)
int status;
int _return_value;
- if (!PyArg_Parse(arg, "i:WCOREDUMP", &status))
+ if (!PyArg_Parse(arg, "i:WCOREDUMP", &status)) {
goto exit;
+ }
_return_value = os_WCOREDUMP_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4295,11 +4415,13 @@ os_WIFCONTINUED(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFCONTINUED", _keywords,
- &status))
+ &status)) {
goto exit;
+ }
_return_value = os_WIFCONTINUED_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4331,11 +4453,13 @@ os_WIFSTOPPED(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSTOPPED", _keywords,
- &status))
+ &status)) {
goto exit;
+ }
_return_value = os_WIFSTOPPED_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4367,11 +4491,13 @@ os_WIFSIGNALED(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSIGNALED", _keywords,
- &status))
+ &status)) {
goto exit;
+ }
_return_value = os_WIFSIGNALED_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4403,11 +4529,13 @@ os_WIFEXITED(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFEXITED", _keywords,
- &status))
+ &status)) {
goto exit;
+ }
_return_value = os_WIFEXITED_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4439,11 +4567,13 @@ os_WEXITSTATUS(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WEXITSTATUS", _keywords,
- &status))
+ &status)) {
goto exit;
+ }
_return_value = os_WEXITSTATUS_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -4475,11 +4605,13 @@ os_WTERMSIG(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WTERMSIG", _keywords,
- &status))
+ &status)) {
goto exit;
+ }
_return_value = os_WTERMSIG_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -4511,11 +4643,13 @@ os_WSTOPSIG(PyObject *module, PyObject *args, PyObject *kwargs)
int _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WSTOPSIG", _keywords,
- &status))
+ &status)) {
goto exit;
+ }
_return_value = os_WSTOPSIG_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -4546,8 +4680,9 @@ os_fstatvfs(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (!PyArg_Parse(arg, "i:fstatvfs", &fd))
+ if (!PyArg_Parse(arg, "i:fstatvfs", &fd)) {
goto exit;
+ }
return_value = os_fstatvfs_impl(module, fd);
exit:
@@ -4582,8 +4717,9 @@ os_statvfs(PyObject *module, PyObject *args, PyObject *kwargs)
path_t path = PATH_T_INITIALIZE("statvfs", "path", 0, PATH_HAVE_FSTATVFS);
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:statvfs", _keywords,
- path_converter, &path))
+ path_converter, &path)) {
goto exit;
+ }
return_value = os_statvfs_impl(module, &path);
exit:
@@ -4617,8 +4753,9 @@ os__getdiskusage(PyObject *module, PyObject *args, PyObject *kwargs)
Py_UNICODE *path;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:_getdiskusage", _keywords,
- &path))
+ &path)) {
goto exit;
+ }
return_value = os__getdiskusage_impl(module, path);
exit:
@@ -4652,11 +4789,13 @@ os_fpathconf(PyObject *module, PyObject *args)
long _return_value;
if (!PyArg_ParseTuple(args, "iO&:fpathconf",
- &fd, conv_path_confname, &name))
+ &fd, conv_path_confname, &name)) {
goto exit;
+ }
_return_value = os_fpathconf_impl(module, fd, name);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -4693,11 +4832,13 @@ os_pathconf(PyObject *module, PyObject *args, PyObject *kwargs)
long _return_value;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:pathconf", _keywords,
- path_converter, &path, conv_path_confname, &name))
+ path_converter, &path, conv_path_confname, &name)) {
goto exit;
+ }
_return_value = os_pathconf_impl(module, &path, name);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -4729,8 +4870,9 @@ os_confstr(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int name;
- if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name))
+ if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name)) {
goto exit;
+ }
return_value = os_confstr_impl(module, name);
exit:
@@ -4760,11 +4902,13 @@ os_sysconf(PyObject *module, PyObject *arg)
int name;
long _return_value;
- if (!PyArg_Parse(arg, "O&:sysconf", conv_sysconf_confname, &name))
+ if (!PyArg_Parse(arg, "O&:sysconf", conv_sysconf_confname, &name)) {
goto exit;
+ }
_return_value = os_sysconf_impl(module, name);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -4843,8 +4987,9 @@ os_device_encoding(PyObject *module, PyObject *args, PyObject *kwargs)
int fd;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:device_encoding", _keywords,
- &fd))
+ &fd)) {
goto exit;
+ }
return_value = os_device_encoding_impl(module, fd);
exit:
@@ -4874,8 +5019,9 @@ os_setresuid(PyObject *module, PyObject *args)
uid_t suid;
if (!PyArg_ParseTuple(args, "O&O&O&:setresuid",
- _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid))
+ _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) {
goto exit;
+ }
return_value = os_setresuid_impl(module, ruid, euid, suid);
exit:
@@ -4907,8 +5053,9 @@ os_setresgid(PyObject *module, PyObject *args)
gid_t sgid;
if (!PyArg_ParseTuple(args, "O&O&O&:setresgid",
- _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid))
+ _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) {
goto exit;
+ }
return_value = os_setresgid_impl(module, rgid, egid, sgid);
exit:
@@ -4991,8 +5138,9 @@ os_getxattr(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$p:getxattr", _keywords,
- path_converter, &path, path_converter, &attribute, &follow_symlinks))
+ path_converter, &path, path_converter, &attribute, &follow_symlinks)) {
goto exit;
+ }
return_value = os_getxattr_impl(module, &path, &attribute, follow_symlinks);
exit:
@@ -5039,8 +5187,9 @@ os_setxattr(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&y*|i$p:setxattr", _keywords,
- path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks))
+ path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks)) {
goto exit;
+ }
return_value = os_setxattr_impl(module, &path, &attribute, &value, flags, follow_symlinks);
exit:
@@ -5049,8 +5198,9 @@ exit:
/* Cleanup for attribute */
path_cleanup(&attribute);
/* Cleanup for value */
- if (value.obj)
+ if (value.obj) {
PyBuffer_Release(&value);
+ }
return return_value;
}
@@ -5087,8 +5237,9 @@ os_removexattr(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$p:removexattr", _keywords,
- path_converter, &path, path_converter, &attribute, &follow_symlinks))
+ path_converter, &path, path_converter, &attribute, &follow_symlinks)) {
goto exit;
+ }
return_value = os_removexattr_impl(module, &path, &attribute, follow_symlinks);
exit:
@@ -5131,8 +5282,9 @@ os_listxattr(PyObject *module, PyObject *args, PyObject *kwargs)
int follow_symlinks = 1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&$p:listxattr", _keywords,
- path_converter, &path, &follow_symlinks))
+ path_converter, &path, &follow_symlinks)) {
goto exit;
+ }
return_value = os_listxattr_impl(module, &path, follow_symlinks);
exit:
@@ -5162,8 +5314,9 @@ os_urandom(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_ssize_t size;
- if (!PyArg_Parse(arg, "n:urandom", &size))
+ if (!PyArg_Parse(arg, "n:urandom", &size)) {
goto exit;
+ }
return_value = os_urandom_impl(module, size);
exit:
@@ -5174,7 +5327,11 @@ PyDoc_STRVAR(os_cpu_count__doc__,
"cpu_count($module, /)\n"
"--\n"
"\n"
-"Return the number of CPUs in the system; return None if indeterminable.");
+"Return the number of CPUs in the system; return None if indeterminable.\n"
+"\n"
+"This number is not equivalent to the number of CPUs the current process can\n"
+"use. The number of usable CPUs can be obtained with\n"
+"``len(os.sched_getaffinity(0))``");
#define OS_CPU_COUNT_METHODDEF \
{"cpu_count", (PyCFunction)os_cpu_count, METH_NOARGS, os_cpu_count__doc__},
@@ -5207,11 +5364,13 @@ os_get_inheritable(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (!PyArg_Parse(arg, "i:get_inheritable", &fd))
+ if (!PyArg_Parse(arg, "i:get_inheritable", &fd)) {
goto exit;
+ }
_return_value = os_get_inheritable_impl(module, fd);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -5238,8 +5397,9 @@ os_set_inheritable(PyObject *module, PyObject *args)
int inheritable;
if (!PyArg_ParseTuple(args, "ii:set_inheritable",
- &fd, &inheritable))
+ &fd, &inheritable)) {
goto exit;
+ }
return_value = os_set_inheritable_impl(module, fd, inheritable);
exit:
@@ -5267,11 +5427,13 @@ os_get_handle_inheritable(PyObject *module, PyObject *arg)
Py_intptr_t handle;
int _return_value;
- if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle)) {
goto exit;
+ }
_return_value = os_get_handle_inheritable_impl(module, handle);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -5303,8 +5465,9 @@ os_set_handle_inheritable(PyObject *module, PyObject *args)
int inheritable;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "p:set_handle_inheritable",
- &handle, &inheritable))
+ &handle, &inheritable)) {
goto exit;
+ }
return_value = os_set_handle_inheritable_impl(module, handle, inheritable);
exit:
@@ -5313,6 +5476,39 @@ exit:
#endif /* defined(MS_WINDOWS) */
+PyDoc_STRVAR(os_fspath__doc__,
+"fspath($module, /, path)\n"
+"--\n"
+"\n"
+"Return the file system path representation of the object.\n"
+"\n"
+"If the object is str or bytes, then allow it to pass through as-is. If the\n"
+"object defines __fspath__(), then return the result of that method. All other\n"
+"types raise a TypeError.");
+
+#define OS_FSPATH_METHODDEF \
+ {"fspath", (PyCFunction)os_fspath, METH_VARARGS|METH_KEYWORDS, os_fspath__doc__},
+
+static PyObject *
+os_fspath_impl(PyObject *module, PyObject *path);
+
+static PyObject *
+os_fspath(PyObject *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", NULL};
+ PyObject *path;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:fspath", _keywords,
+ &path)) {
+ goto exit;
+ }
+ return_value = os_fspath_impl(module, path);
+
+exit:
+ return return_value;
+}
+
#ifndef OS_TTYNAME_METHODDEF
#define OS_TTYNAME_METHODDEF
#endif /* !defined(OS_TTYNAME_METHODDEF) */
@@ -5784,4 +5980,4 @@ exit:
#ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF
#define OS_SET_HANDLE_INHERITABLE_METHODDEF
#endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */
-/*[clinic end generated code: output=c27221987f987cf3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e91e62d8e8f1b6ac input=a9049054013a1b77]*/