From b55f2995d9a89d746027640c22c0fd0b0801e1ce Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 6 Nov 2016 13:45:33 +0200 Subject: Issue #28586: Converted os.scandir() to Argument Clinic. --- Modules/clinic/posixmodule.c.h | 205 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 204 insertions(+), 1 deletion(-) (limited to 'Modules/clinic/posixmodule.c.h') diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 72d7834211..9de5b0391f 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -5596,6 +5596,209 @@ exit: #endif /* defined(MS_WINDOWS) */ +PyDoc_STRVAR(os_DirEntry_is_symlink__doc__, +"is_symlink($self, /)\n" +"--\n" +"\n" +"Return True if the entry is a symbolic link; cached per entry."); + +#define OS_DIRENTRY_IS_SYMLINK_METHODDEF \ + {"is_symlink", (PyCFunction)os_DirEntry_is_symlink, METH_NOARGS, os_DirEntry_is_symlink__doc__}, + +static int +os_DirEntry_is_symlink_impl(DirEntry *self); + +static PyObject * +os_DirEntry_is_symlink(DirEntry *self, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = os_DirEntry_is_symlink_impl(self); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(os_DirEntry_stat__doc__, +"stat($self, /, *, follow_symlinks=True)\n" +"--\n" +"\n" +"Return stat_result object for the entry; cached per entry."); + +#define OS_DIRENTRY_STAT_METHODDEF \ + {"stat", (PyCFunction)os_DirEntry_stat, METH_FASTCALL, os_DirEntry_stat__doc__}, + +static PyObject * +os_DirEntry_stat_impl(DirEntry *self, int follow_symlinks); + +static PyObject * +os_DirEntry_stat(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"|$p:stat", _keywords, 0}; + int follow_symlinks = 1; + + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + &follow_symlinks)) { + goto exit; + } + return_value = os_DirEntry_stat_impl(self, follow_symlinks); + +exit: + return return_value; +} + +PyDoc_STRVAR(os_DirEntry_is_dir__doc__, +"is_dir($self, /, *, follow_symlinks=True)\n" +"--\n" +"\n" +"Return True if the entry is a directory; cached per entry."); + +#define OS_DIRENTRY_IS_DIR_METHODDEF \ + {"is_dir", (PyCFunction)os_DirEntry_is_dir, METH_FASTCALL, os_DirEntry_is_dir__doc__}, + +static int +os_DirEntry_is_dir_impl(DirEntry *self, int follow_symlinks); + +static PyObject * +os_DirEntry_is_dir(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"|$p:is_dir", _keywords, 0}; + int follow_symlinks = 1; + int _return_value; + + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + &follow_symlinks)) { + goto exit; + } + _return_value = os_DirEntry_is_dir_impl(self, follow_symlinks); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(os_DirEntry_is_file__doc__, +"is_file($self, /, *, follow_symlinks=True)\n" +"--\n" +"\n" +"Return True if the entry is a file; cached per entry."); + +#define OS_DIRENTRY_IS_FILE_METHODDEF \ + {"is_file", (PyCFunction)os_DirEntry_is_file, METH_FASTCALL, os_DirEntry_is_file__doc__}, + +static int +os_DirEntry_is_file_impl(DirEntry *self, int follow_symlinks); + +static PyObject * +os_DirEntry_is_file(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"|$p:is_file", _keywords, 0}; + int follow_symlinks = 1; + int _return_value; + + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + &follow_symlinks)) { + goto exit; + } + _return_value = os_DirEntry_is_file_impl(self, follow_symlinks); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(os_DirEntry_inode__doc__, +"inode($self, /)\n" +"--\n" +"\n" +"Return inode of the entry; cached per entry."); + +#define OS_DIRENTRY_INODE_METHODDEF \ + {"inode", (PyCFunction)os_DirEntry_inode, METH_NOARGS, os_DirEntry_inode__doc__}, + +static PyObject * +os_DirEntry_inode_impl(DirEntry *self); + +static PyObject * +os_DirEntry_inode(DirEntry *self, PyObject *Py_UNUSED(ignored)) +{ + return os_DirEntry_inode_impl(self); +} + +PyDoc_STRVAR(os_DirEntry___fspath____doc__, +"__fspath__($self, /)\n" +"--\n" +"\n" +"Returns the path for the entry."); + +#define OS_DIRENTRY___FSPATH___METHODDEF \ + {"__fspath__", (PyCFunction)os_DirEntry___fspath__, METH_NOARGS, os_DirEntry___fspath____doc__}, + +static PyObject * +os_DirEntry___fspath___impl(DirEntry *self); + +static PyObject * +os_DirEntry___fspath__(DirEntry *self, PyObject *Py_UNUSED(ignored)) +{ + return os_DirEntry___fspath___impl(self); +} + +PyDoc_STRVAR(os_scandir__doc__, +"scandir($module, /, path=None)\n" +"--\n" +"\n" +"Return an iterator of DirEntry objects for given path.\n" +"\n" +"path can be specified as either str, bytes or path-like object. If path\n" +"is bytes, the names of yielded DirEntry objects will also be bytes; in\n" +"all other circumstances they will be str.\n" +"\n" +"If path is None, uses the path=\'.\'."); + +#define OS_SCANDIR_METHODDEF \ + {"scandir", (PyCFunction)os_scandir, METH_FASTCALL, os_scandir__doc__}, + +static PyObject * +os_scandir_impl(PyObject *module, path_t *path); + +static PyObject * +os_scandir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"|O&:scandir", _keywords, 0}; + path_t path = PATH_T_INITIALIZE("scandir", "path", 1, 0); + + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + path_converter, &path)) { + goto exit; + } + return_value = os_scandir_impl(module, &path); + +exit: + /* Cleanup for path */ + path_cleanup(&path); + + return return_value; +} + PyDoc_STRVAR(os_fspath__doc__, "fspath($module, /, path)\n" "--\n" @@ -6148,4 +6351,4 @@ exit: #ifndef OS_GETRANDOM_METHODDEF #define OS_GETRANDOM_METHODDEF #endif /* !defined(OS_GETRANDOM_METHODDEF) */ -/*[clinic end generated code: output=b9ed5703d2feb0d9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=e4a3bd36c7bb8356 input=a9049054013a1b77]*/ -- cgit v1.2.1 From 271403abe36069797ac332e1c6eae3473878db20 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 17 Jan 2017 01:29:01 +0100 Subject: Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywords Issue #29286. --- Modules/clinic/posixmodule.c.h | 134 ++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'Modules/clinic/posixmodule.c.h') diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 2c0074a1a5..9b98dd20a8 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -42,7 +42,7 @@ os_stat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; } @@ -79,7 +79,7 @@ os_lstat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) path_t path = PATH_T_INITIALIZE("lstat", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -144,7 +144,7 @@ os_access(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames int follow_symlinks = 1; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks)) { goto exit; } @@ -246,7 +246,7 @@ os_chdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"O&:chdir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chdir", "path", 0, PATH_HAVE_FCHDIR); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -284,7 +284,7 @@ os_fchdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames static _PyArg_Parser _parser = {"O&:fchdir", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, fildes_converter, &fd)) { goto exit; } @@ -340,7 +340,7 @@ os_chmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; } @@ -378,7 +378,7 @@ os_fchmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames int fd; int mode; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd, &mode)) { goto exit; } @@ -416,7 +416,7 @@ os_lchmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames path_t path = PATH_T_INITIALIZE("lchmod", "path", 0, 0); int mode; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode)) { goto exit; } @@ -462,7 +462,7 @@ os_chflags(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname unsigned long flags; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &flags, &follow_symlinks)) { goto exit; } @@ -503,7 +503,7 @@ os_lchflags(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam path_t path = PATH_T_INITIALIZE("lchflags", "path", 0, 0); unsigned long flags; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &flags)) { goto exit; } @@ -540,7 +540,7 @@ os_chroot(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames static _PyArg_Parser _parser = {"O&:chroot", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chroot", "path", 0, 0); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -577,7 +577,7 @@ os_fsync(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"O&:fsync", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, fildes_converter, &fd)) { goto exit; } @@ -633,7 +633,7 @@ os_fdatasync(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna static _PyArg_Parser _parser = {"O&:fdatasync", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, fildes_converter, &fd)) { goto exit; } @@ -696,7 +696,7 @@ os_chown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; } @@ -737,7 +737,7 @@ os_fchown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames uid_t uid; gid_t gid; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) { goto exit; } @@ -776,7 +776,7 @@ os_lchown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames uid_t uid; gid_t gid; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) { goto exit; } @@ -865,7 +865,7 @@ os_link(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dst_dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks)) { goto exit; } @@ -913,7 +913,7 @@ os_listdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname static _PyArg_Parser _parser = {"|O&:listdir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("listdir", "path", 1, PATH_HAVE_FDOPENDIR); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -1046,7 +1046,7 @@ os__getvolumepathname(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObj static _PyArg_Parser _parser = {"U:_getvolumepathname", _keywords, 0}; PyObject *path; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path)) { goto exit; } @@ -1087,7 +1087,7 @@ os_mkdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int mode = 511; int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -1154,7 +1154,7 @@ os_getpriority(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw int which; int who; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &which, &who)) { goto exit; } @@ -1190,7 +1190,7 @@ os_setpriority(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw int who; int priority; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &which, &who, &priority)) { goto exit; } @@ -1232,7 +1232,7 @@ os_rename(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames int src_dir_fd = DEFAULT_DIR_FD; int dst_dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) { goto exit; } @@ -1277,7 +1277,7 @@ os_replace(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname int src_dir_fd = DEFAULT_DIR_FD; int dst_dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) { goto exit; } @@ -1318,7 +1318,7 @@ os_rmdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) path_t path = PATH_T_INITIALIZE("rmdir", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -1354,7 +1354,7 @@ os_system(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames Py_UNICODE *command; long _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &command)) { goto exit; } @@ -1393,7 +1393,7 @@ os_system(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames PyObject *command = NULL; long _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, PyUnicode_FSConverter, &command)) { goto exit; } @@ -1465,7 +1465,7 @@ os_unlink(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames path_t path = PATH_T_INITIALIZE("unlink", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -1504,7 +1504,7 @@ os_remove(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames path_t path = PATH_T_INITIALIZE("remove", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -1590,7 +1590,7 @@ os_utime(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, ×, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; } @@ -1623,7 +1623,7 @@ os__exit(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"i:_exit", _keywords, 0}; int status; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -1705,7 +1705,7 @@ os_execve(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames PyObject *argv; PyObject *env; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &argv, &env)) { goto exit; } @@ -1882,7 +1882,7 @@ os_sched_get_priority_max(PyObject *module, PyObject **args, Py_ssize_t nargs, P static _PyArg_Parser _parser = {"i:sched_get_priority_max", _keywords, 0}; int policy; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &policy)) { goto exit; } @@ -1916,7 +1916,7 @@ os_sched_get_priority_min(PyObject *module, PyObject **args, Py_ssize_t nargs, P static _PyArg_Parser _parser = {"i:sched_get_priority_min", _keywords, 0}; int policy; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &policy)) { goto exit; } @@ -2416,7 +2416,7 @@ os_getpgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname static _PyArg_Parser _parser = {"" _Py_PARSE_PID ":getpgid", _keywords, 0}; pid_t pid; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &pid)) { goto exit; } @@ -2866,7 +2866,7 @@ os_wait3(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"i:wait3", _keywords, 0}; int options; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &options)) { goto exit; } @@ -2904,7 +2904,7 @@ os_wait4(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) pid_t pid; int options; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &pid, &options)) { goto exit; } @@ -3098,7 +3098,7 @@ os_symlink(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname int target_is_directory = 0; int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -3320,7 +3320,7 @@ os_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -3357,7 +3357,7 @@ os_close(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"i:close", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd)) { goto exit; } @@ -3450,7 +3450,7 @@ os_dup2(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int fd2; int inheritable = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd, &fd2, &inheritable)) { goto exit; } @@ -3713,7 +3713,7 @@ os_fstat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"i:fstat", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd)) { goto exit; } @@ -3938,7 +3938,7 @@ os_mkfifo(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames int mode = 438; int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -3991,7 +3991,7 @@ os_mknod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) dev_t device = 0; int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -4175,7 +4175,7 @@ os_truncate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam path_t path = PATH_T_INITIALIZE("truncate", "path", 0, PATH_HAVE_FTRUNCATE); Py_off_t length; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, Py_off_t_converter, &length)) { goto exit; } @@ -4466,7 +4466,7 @@ os_WIFCONTINUED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4505,7 +4505,7 @@ os_WIFSTOPPED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4544,7 +4544,7 @@ os_WIFSIGNALED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4583,7 +4583,7 @@ os_WIFEXITED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4622,7 +4622,7 @@ os_WEXITSTATUS(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4661,7 +4661,7 @@ os_WTERMSIG(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4700,7 +4700,7 @@ os_WSTOPSIG(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4775,7 +4775,7 @@ os_statvfs(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname static _PyArg_Parser _parser = {"O&:statvfs", _keywords, 0}; path_t path = PATH_T_INITIALIZE("statvfs", "path", 0, PATH_HAVE_FSTATVFS); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -4812,7 +4812,7 @@ os__getdiskusage(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject * static _PyArg_Parser _parser = {"u:_getdiskusage", _keywords, 0}; Py_UNICODE *path; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path)) { goto exit; } @@ -4892,7 +4892,7 @@ os_pathconf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int name; long _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, conv_path_confname, &name)) { goto exit; } @@ -5039,7 +5039,7 @@ os_startfile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna path_t filepath = PATH_T_INITIALIZE("startfile", "filepath", 0, 0); Py_UNICODE *operation = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &filepath, &operation)) { goto exit; } @@ -5103,7 +5103,7 @@ os_device_encoding(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject static _PyArg_Parser _parser = {"i:device_encoding", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd)) { goto exit; } @@ -5255,7 +5255,7 @@ os_getxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam path_t attribute = PATH_T_INITIALIZE("getxattr", "attribute", 0, 0); int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, path_converter, &attribute, &follow_symlinks)) { goto exit; } @@ -5305,7 +5305,7 @@ os_setxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int flags = 0; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks)) { goto exit; } @@ -5356,7 +5356,7 @@ os_removexattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw path_t attribute = PATH_T_INITIALIZE("removexattr", "attribute", 0, 0); int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, path_converter, &attribute, &follow_symlinks)) { goto exit; } @@ -5402,7 +5402,7 @@ os_listxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna path_t path = PATH_T_INITIALIZE("listxattr", "path", 1, 1); int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &follow_symlinks)) { goto exit; } @@ -5645,7 +5645,7 @@ os_DirEntry_stat(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject *kw static _PyArg_Parser _parser = {"|$p:stat", _keywords, 0}; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &follow_symlinks)) { goto exit; } @@ -5676,7 +5676,7 @@ os_DirEntry_is_dir(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject * int follow_symlinks = 1; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &follow_symlinks)) { goto exit; } @@ -5711,7 +5711,7 @@ os_DirEntry_is_file(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject int follow_symlinks = 1; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &follow_symlinks)) { goto exit; } @@ -5787,7 +5787,7 @@ os_scandir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname static _PyArg_Parser _parser = {"|O&:scandir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("scandir", "path", 1, 0); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -5824,7 +5824,7 @@ os_fspath(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames static _PyArg_Parser _parser = {"O:fspath", _keywords, 0}; PyObject *path; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path)) { goto exit; } @@ -5857,7 +5857,7 @@ os_getrandom(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna Py_ssize_t size; int flags = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &size, &flags)) { goto exit; } -- cgit v1.2.1 From 7372e18fa83aa35766f8f6fdf3aed27fac2d52d2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 17 Jan 2017 01:35:17 +0100 Subject: Run Argument Clinic: METH_VARARGS=>METH_FASTCALL Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using only positional arguments. --- Modules/clinic/posixmodule.c.h | 352 ++++++++++++++++++++++++++++------------- 1 file changed, 246 insertions(+), 106 deletions(-) (limited to 'Modules/clinic/posixmodule.c.h') diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 9b98dd20a8..c88716f111 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -1647,22 +1647,26 @@ PyDoc_STRVAR(os_execv__doc__, " Tuple or list of strings."); #define OS_EXECV_METHODDEF \ - {"execv", (PyCFunction)os_execv, METH_VARARGS, os_execv__doc__}, + {"execv", (PyCFunction)os_execv, METH_FASTCALL, os_execv__doc__}, static PyObject * os_execv_impl(PyObject *module, path_t *path, PyObject *argv); static PyObject * -os_execv(PyObject *module, PyObject *args) +os_execv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; path_t path = PATH_T_INITIALIZE("execv", "path", 0, 0); PyObject *argv; - if (!PyArg_ParseTuple(args, "O&O:execv", + if (!_PyArg_ParseStack(args, nargs, "O&O:execv", path_converter, &path, &argv)) { goto exit; } + + if (!_PyArg_NoStackKeywords("execv", kwnames)) { + goto exit; + } return_value = os_execv_impl(module, &path, argv); exit: @@ -1736,23 +1740,27 @@ PyDoc_STRVAR(os_spawnv__doc__, " Tuple or list of strings."); #define OS_SPAWNV_METHODDEF \ - {"spawnv", (PyCFunction)os_spawnv, METH_VARARGS, os_spawnv__doc__}, + {"spawnv", (PyCFunction)os_spawnv, METH_FASTCALL, os_spawnv__doc__}, static PyObject * os_spawnv_impl(PyObject *module, int mode, path_t *path, PyObject *argv); static PyObject * -os_spawnv(PyObject *module, PyObject *args) +os_spawnv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int mode; path_t path = PATH_T_INITIALIZE("spawnv", "path", 0, 0); PyObject *argv; - if (!PyArg_ParseTuple(args, "iO&O:spawnv", + if (!_PyArg_ParseStack(args, nargs, "iO&O:spawnv", &mode, path_converter, &path, &argv)) { goto exit; } + + if (!_PyArg_NoStackKeywords("spawnv", kwnames)) { + goto exit; + } return_value = os_spawnv_impl(module, mode, &path, argv); exit: @@ -1782,14 +1790,14 @@ PyDoc_STRVAR(os_spawnve__doc__, " Dictionary of strings mapping to strings."); #define OS_SPAWNVE_METHODDEF \ - {"spawnve", (PyCFunction)os_spawnve, METH_VARARGS, os_spawnve__doc__}, + {"spawnve", (PyCFunction)os_spawnve, METH_FASTCALL, os_spawnve__doc__}, static PyObject * os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv, PyObject *env); static PyObject * -os_spawnve(PyObject *module, PyObject *args) +os_spawnve(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int mode; @@ -1797,10 +1805,14 @@ os_spawnve(PyObject *module, PyObject *args) PyObject *argv; PyObject *env; - if (!PyArg_ParseTuple(args, "iO&OO:spawnve", + if (!_PyArg_ParseStack(args, nargs, "iO&OO:spawnve", &mode, path_converter, &path, &argv, &env)) { goto exit; } + + if (!_PyArg_NoStackKeywords("spawnve", kwnames)) { + goto exit; + } return_value = os_spawnve_impl(module, mode, &path, argv, env); exit: @@ -2007,24 +2019,28 @@ PyDoc_STRVAR(os_sched_setscheduler__doc__, "param is an instance of sched_param."); #define OS_SCHED_SETSCHEDULER_METHODDEF \ - {"sched_setscheduler", (PyCFunction)os_sched_setscheduler, METH_VARARGS, os_sched_setscheduler__doc__}, + {"sched_setscheduler", (PyCFunction)os_sched_setscheduler, METH_FASTCALL, os_sched_setscheduler__doc__}, static PyObject * os_sched_setscheduler_impl(PyObject *module, pid_t pid, int policy, struct sched_param *param); static PyObject * -os_sched_setscheduler(PyObject *module, PyObject *args) +os_sched_setscheduler(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; int policy; struct sched_param param; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "iO&:sched_setscheduler", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "iO&:sched_setscheduler", &pid, &policy, convert_sched_param, ¶m)) { goto exit; } + + if (!_PyArg_NoStackKeywords("sched_setscheduler", kwnames)) { + goto exit; + } return_value = os_sched_setscheduler_impl(module, pid, policy, ¶m); exit: @@ -2079,23 +2095,27 @@ PyDoc_STRVAR(os_sched_setparam__doc__, "param should be an instance of sched_param."); #define OS_SCHED_SETPARAM_METHODDEF \ - {"sched_setparam", (PyCFunction)os_sched_setparam, METH_VARARGS, os_sched_setparam__doc__}, + {"sched_setparam", (PyCFunction)os_sched_setparam, METH_FASTCALL, os_sched_setparam__doc__}, static PyObject * os_sched_setparam_impl(PyObject *module, pid_t pid, struct sched_param *param); static PyObject * -os_sched_setparam(PyObject *module, PyObject *args) +os_sched_setparam(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; struct sched_param param; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O&:sched_setparam", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O&:sched_setparam", &pid, convert_sched_param, ¶m)) { goto exit; } + + if (!_PyArg_NoStackKeywords("sched_setparam", kwnames)) { + goto exit; + } return_value = os_sched_setparam_impl(module, pid, ¶m); exit: @@ -2175,22 +2195,26 @@ PyDoc_STRVAR(os_sched_setaffinity__doc__, "mask should be an iterable of integers identifying CPUs."); #define OS_SCHED_SETAFFINITY_METHODDEF \ - {"sched_setaffinity", (PyCFunction)os_sched_setaffinity, METH_VARARGS, os_sched_setaffinity__doc__}, + {"sched_setaffinity", (PyCFunction)os_sched_setaffinity, METH_FASTCALL, os_sched_setaffinity__doc__}, static PyObject * os_sched_setaffinity_impl(PyObject *module, pid_t pid, PyObject *mask); static PyObject * -os_sched_setaffinity(PyObject *module, PyObject *args) +os_sched_setaffinity(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; PyObject *mask; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O:sched_setaffinity", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O:sched_setaffinity", &pid, &mask)) { goto exit; } + + if (!_PyArg_NoStackKeywords("sched_setaffinity", kwnames)) { + goto exit; + } return_value = os_sched_setaffinity_impl(module, pid, mask); exit: @@ -2550,22 +2574,26 @@ PyDoc_STRVAR(os_kill__doc__, "Kill a process with a signal."); #define OS_KILL_METHODDEF \ - {"kill", (PyCFunction)os_kill, METH_VARARGS, os_kill__doc__}, + {"kill", (PyCFunction)os_kill, METH_FASTCALL, os_kill__doc__}, static PyObject * os_kill_impl(PyObject *module, pid_t pid, Py_ssize_t signal); static PyObject * -os_kill(PyObject *module, PyObject *args) +os_kill(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; Py_ssize_t signal; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "n:kill", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "n:kill", &pid, &signal)) { goto exit; } + + if (!_PyArg_NoStackKeywords("kill", kwnames)) { + goto exit; + } return_value = os_kill_impl(module, pid, signal); exit: @@ -2583,22 +2611,26 @@ PyDoc_STRVAR(os_killpg__doc__, "Kill a process group with a signal."); #define OS_KILLPG_METHODDEF \ - {"killpg", (PyCFunction)os_killpg, METH_VARARGS, os_killpg__doc__}, + {"killpg", (PyCFunction)os_killpg, METH_FASTCALL, os_killpg__doc__}, static PyObject * os_killpg_impl(PyObject *module, pid_t pgid, int signal); static PyObject * -os_killpg(PyObject *module, PyObject *args) +os_killpg(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pgid; int signal; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:killpg", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "i:killpg", &pgid, &signal)) { goto exit; } + + if (!_PyArg_NoStackKeywords("killpg", kwnames)) { + goto exit; + } return_value = os_killpg_impl(module, pgid, signal); exit: @@ -2740,22 +2772,26 @@ PyDoc_STRVAR(os_setreuid__doc__, "Set the current process\'s real and effective user ids."); #define OS_SETREUID_METHODDEF \ - {"setreuid", (PyCFunction)os_setreuid, METH_VARARGS, os_setreuid__doc__}, + {"setreuid", (PyCFunction)os_setreuid, METH_FASTCALL, os_setreuid__doc__}, static PyObject * os_setreuid_impl(PyObject *module, uid_t ruid, uid_t euid); static PyObject * -os_setreuid(PyObject *module, PyObject *args) +os_setreuid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; uid_t ruid; uid_t euid; - if (!PyArg_ParseTuple(args, "O&O&:setreuid", + if (!_PyArg_ParseStack(args, nargs, "O&O&:setreuid", _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setreuid", kwnames)) { + goto exit; + } return_value = os_setreuid_impl(module, ruid, euid); exit: @@ -2773,22 +2809,26 @@ PyDoc_STRVAR(os_setregid__doc__, "Set the current process\'s real and effective group ids."); #define OS_SETREGID_METHODDEF \ - {"setregid", (PyCFunction)os_setregid, METH_VARARGS, os_setregid__doc__}, + {"setregid", (PyCFunction)os_setregid, METH_FASTCALL, os_setregid__doc__}, static PyObject * os_setregid_impl(PyObject *module, gid_t rgid, gid_t egid); static PyObject * -os_setregid(PyObject *module, PyObject *args) +os_setregid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; gid_t rgid; gid_t egid; - if (!PyArg_ParseTuple(args, "O&O&:setregid", + if (!_PyArg_ParseStack(args, nargs, "O&O&:setregid", _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setregid", kwnames)) { + goto exit; + } return_value = os_setregid_impl(module, rgid, egid); exit: @@ -2936,23 +2976,27 @@ PyDoc_STRVAR(os_waitid__doc__, "no children in a waitable state."); #define OS_WAITID_METHODDEF \ - {"waitid", (PyCFunction)os_waitid, METH_VARARGS, os_waitid__doc__}, + {"waitid", (PyCFunction)os_waitid, METH_FASTCALL, os_waitid__doc__}, static PyObject * os_waitid_impl(PyObject *module, idtype_t idtype, id_t id, int options); static PyObject * -os_waitid(PyObject *module, PyObject *args) +os_waitid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; idtype_t idtype; id_t id; int options; - if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID "i:waitid", + if (!_PyArg_ParseStack(args, nargs, "i" _Py_PARSE_PID "i:waitid", &idtype, &id, &options)) { goto exit; } + + if (!_PyArg_NoStackKeywords("waitid", kwnames)) { + goto exit; + } return_value = os_waitid_impl(module, idtype, id, options); exit: @@ -2975,22 +3019,26 @@ PyDoc_STRVAR(os_waitpid__doc__, "The options argument is ignored on Windows."); #define OS_WAITPID_METHODDEF \ - {"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__}, + {"waitpid", (PyCFunction)os_waitpid, METH_FASTCALL, os_waitpid__doc__}, static PyObject * os_waitpid_impl(PyObject *module, pid_t pid, int options); static PyObject * -os_waitpid(PyObject *module, PyObject *args) +os_waitpid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; int options; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:waitpid", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "i:waitpid", &pid, &options)) { goto exit; } + + if (!_PyArg_NoStackKeywords("waitpid", kwnames)) { + goto exit; + } return_value = os_waitpid_impl(module, pid, options); exit: @@ -3013,22 +3061,26 @@ PyDoc_STRVAR(os_waitpid__doc__, "The options argument is ignored on Windows."); #define OS_WAITPID_METHODDEF \ - {"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__}, + {"waitpid", (PyCFunction)os_waitpid, METH_FASTCALL, os_waitpid__doc__}, static PyObject * os_waitpid_impl(PyObject *module, intptr_t pid, int options); static PyObject * -os_waitpid(PyObject *module, PyObject *args) +os_waitpid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; intptr_t pid; int options; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "i:waitpid", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_INTPTR "i:waitpid", &pid, &options)) { goto exit; } + + if (!_PyArg_NoStackKeywords("waitpid", kwnames)) { + goto exit; + } return_value = os_waitpid_impl(module, pid, options); exit: @@ -3203,22 +3255,26 @@ PyDoc_STRVAR(os_setpgid__doc__, "Call the system call setpgid(pid, pgrp)."); #define OS_SETPGID_METHODDEF \ - {"setpgid", (PyCFunction)os_setpgid, METH_VARARGS, os_setpgid__doc__}, + {"setpgid", (PyCFunction)os_setpgid, METH_FASTCALL, os_setpgid__doc__}, static PyObject * os_setpgid_impl(PyObject *module, pid_t pid, pid_t pgrp); static PyObject * -os_setpgid(PyObject *module, PyObject *args) +os_setpgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; pid_t pgrp; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid", &pid, &pgrp)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setpgid", kwnames)) { + goto exit; + } return_value = os_setpgid_impl(module, pid, pgrp); exit: @@ -3267,22 +3323,26 @@ PyDoc_STRVAR(os_tcsetpgrp__doc__, "Set the process group associated with the terminal specified by fd."); #define OS_TCSETPGRP_METHODDEF \ - {"tcsetpgrp", (PyCFunction)os_tcsetpgrp, METH_VARARGS, os_tcsetpgrp__doc__}, + {"tcsetpgrp", (PyCFunction)os_tcsetpgrp, METH_FASTCALL, os_tcsetpgrp__doc__}, static PyObject * os_tcsetpgrp_impl(PyObject *module, int fd, pid_t pgid); static PyObject * -os_tcsetpgrp(PyObject *module, PyObject *args) +os_tcsetpgrp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; pid_t pgid; - if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID ":tcsetpgrp", + if (!_PyArg_ParseStack(args, nargs, "i" _Py_PARSE_PID ":tcsetpgrp", &fd, &pgid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("tcsetpgrp", kwnames)) { + goto exit; + } return_value = os_tcsetpgrp_impl(module, fd, pgid); exit: @@ -3374,22 +3434,26 @@ PyDoc_STRVAR(os_closerange__doc__, "Closes all file descriptors in [fd_low, fd_high), ignoring errors."); #define OS_CLOSERANGE_METHODDEF \ - {"closerange", (PyCFunction)os_closerange, METH_VARARGS, os_closerange__doc__}, + {"closerange", (PyCFunction)os_closerange, METH_FASTCALL, os_closerange__doc__}, static PyObject * os_closerange_impl(PyObject *module, int fd_low, int fd_high); static PyObject * -os_closerange(PyObject *module, PyObject *args) +os_closerange(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd_low; int fd_high; - if (!PyArg_ParseTuple(args, "ii:closerange", + if (!_PyArg_ParseStack(args, nargs, "ii:closerange", &fd_low, &fd_high)) { goto exit; } + + if (!_PyArg_NoStackKeywords("closerange", kwnames)) { + goto exit; + } return_value = os_closerange_impl(module, fd_low, fd_high); exit: @@ -3476,23 +3540,27 @@ PyDoc_STRVAR(os_lockf__doc__, " The number of bytes to lock, starting at the current position."); #define OS_LOCKF_METHODDEF \ - {"lockf", (PyCFunction)os_lockf, METH_VARARGS, os_lockf__doc__}, + {"lockf", (PyCFunction)os_lockf, METH_FASTCALL, os_lockf__doc__}, static PyObject * os_lockf_impl(PyObject *module, int fd, int command, Py_off_t length); static PyObject * -os_lockf(PyObject *module, PyObject *args) +os_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int command; Py_off_t length; - if (!PyArg_ParseTuple(args, "iiO&:lockf", + if (!_PyArg_ParseStack(args, nargs, "iiO&:lockf", &fd, &command, Py_off_t_converter, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lockf", kwnames)) { + goto exit; + } return_value = os_lockf_impl(module, fd, command, length); exit: @@ -3511,13 +3579,13 @@ PyDoc_STRVAR(os_lseek__doc__, "relative to the beginning of the file."); #define OS_LSEEK_METHODDEF \ - {"lseek", (PyCFunction)os_lseek, METH_VARARGS, os_lseek__doc__}, + {"lseek", (PyCFunction)os_lseek, METH_FASTCALL, os_lseek__doc__}, static Py_off_t os_lseek_impl(PyObject *module, int fd, Py_off_t position, int how); static PyObject * -os_lseek(PyObject *module, PyObject *args) +os_lseek(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; @@ -3525,10 +3593,14 @@ os_lseek(PyObject *module, PyObject *args) int how; Py_off_t _return_value; - if (!PyArg_ParseTuple(args, "iO&i:lseek", + if (!_PyArg_ParseStack(args, nargs, "iO&i:lseek", &fd, Py_off_t_converter, &position, &how)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lseek", kwnames)) { + goto exit; + } _return_value = os_lseek_impl(module, fd, position, how); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3546,22 +3618,26 @@ PyDoc_STRVAR(os_read__doc__, "Read from a file descriptor. Returns a bytes object."); #define OS_READ_METHODDEF \ - {"read", (PyCFunction)os_read, METH_VARARGS, os_read__doc__}, + {"read", (PyCFunction)os_read, METH_FASTCALL, os_read__doc__}, static PyObject * os_read_impl(PyObject *module, int fd, Py_ssize_t length); static PyObject * -os_read(PyObject *module, PyObject *args) +os_read(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; Py_ssize_t length; - if (!PyArg_ParseTuple(args, "in:read", + if (!_PyArg_ParseStack(args, nargs, "in:read", &fd, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = os_read_impl(module, fd, length); exit: @@ -3585,23 +3661,27 @@ PyDoc_STRVAR(os_readv__doc__, "which may be less than the total capacity of all the buffers."); #define OS_READV_METHODDEF \ - {"readv", (PyCFunction)os_readv, METH_VARARGS, os_readv__doc__}, + {"readv", (PyCFunction)os_readv, METH_FASTCALL, os_readv__doc__}, static Py_ssize_t os_readv_impl(PyObject *module, int fd, PyObject *buffers); static PyObject * -os_readv(PyObject *module, PyObject *args) +os_readv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; PyObject *buffers; Py_ssize_t _return_value; - if (!PyArg_ParseTuple(args, "iO:readv", + if (!_PyArg_ParseStack(args, nargs, "iO:readv", &fd, &buffers)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readv", kwnames)) { + goto exit; + } _return_value = os_readv_impl(module, fd, buffers); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3626,23 +3706,27 @@ PyDoc_STRVAR(os_pread__doc__, "the beginning of the file. The file offset remains unchanged."); #define OS_PREAD_METHODDEF \ - {"pread", (PyCFunction)os_pread, METH_VARARGS, os_pread__doc__}, + {"pread", (PyCFunction)os_pread, METH_FASTCALL, os_pread__doc__}, static PyObject * os_pread_impl(PyObject *module, int fd, int length, Py_off_t offset); static PyObject * -os_pread(PyObject *module, PyObject *args) +os_pread(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int length; Py_off_t offset; - if (!PyArg_ParseTuple(args, "iiO&:pread", + if (!_PyArg_ParseStack(args, nargs, "iiO&:pread", &fd, &length, Py_off_t_converter, &offset)) { goto exit; } + + if (!_PyArg_NoStackKeywords("pread", kwnames)) { + goto exit; + } return_value = os_pread_impl(module, fd, length, offset); exit: @@ -3658,23 +3742,27 @@ PyDoc_STRVAR(os_write__doc__, "Write a bytes object to a file descriptor."); #define OS_WRITE_METHODDEF \ - {"write", (PyCFunction)os_write, METH_VARARGS, os_write__doc__}, + {"write", (PyCFunction)os_write, METH_FASTCALL, os_write__doc__}, static Py_ssize_t os_write_impl(PyObject *module, int fd, Py_buffer *data); static PyObject * -os_write(PyObject *module, PyObject *args) +os_write(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; Py_buffer data = {NULL, NULL}; Py_ssize_t _return_value; - if (!PyArg_ParseTuple(args, "iy*:write", + if (!_PyArg_ParseStack(args, nargs, "iy*:write", &fd, &data)) { goto exit; } + + if (!_PyArg_NoStackKeywords("write", kwnames)) { + goto exit; + } _return_value = os_write_impl(module, fd, &data); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3832,23 +3920,27 @@ PyDoc_STRVAR(os_writev__doc__, "buffers must be a sequence of bytes-like objects."); #define OS_WRITEV_METHODDEF \ - {"writev", (PyCFunction)os_writev, METH_VARARGS, os_writev__doc__}, + {"writev", (PyCFunction)os_writev, METH_FASTCALL, os_writev__doc__}, static Py_ssize_t os_writev_impl(PyObject *module, int fd, PyObject *buffers); static PyObject * -os_writev(PyObject *module, PyObject *args) +os_writev(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; PyObject *buffers; Py_ssize_t _return_value; - if (!PyArg_ParseTuple(args, "iO:writev", + if (!_PyArg_ParseStack(args, nargs, "iO:writev", &fd, &buffers)) { goto exit; } + + if (!_PyArg_NoStackKeywords("writev", kwnames)) { + goto exit; + } _return_value = os_writev_impl(module, fd, buffers); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3874,13 +3966,13 @@ PyDoc_STRVAR(os_pwrite__doc__, "current file offset."); #define OS_PWRITE_METHODDEF \ - {"pwrite", (PyCFunction)os_pwrite, METH_VARARGS, os_pwrite__doc__}, + {"pwrite", (PyCFunction)os_pwrite, METH_FASTCALL, os_pwrite__doc__}, static Py_ssize_t os_pwrite_impl(PyObject *module, int fd, Py_buffer *buffer, Py_off_t offset); static PyObject * -os_pwrite(PyObject *module, PyObject *args) +os_pwrite(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; @@ -3888,10 +3980,14 @@ os_pwrite(PyObject *module, PyObject *args) Py_off_t offset; Py_ssize_t _return_value; - if (!PyArg_ParseTuple(args, "iy*O&:pwrite", + if (!_PyArg_ParseStack(args, nargs, "iy*O&:pwrite", &fd, &buffer, Py_off_t_converter, &offset)) { goto exit; } + + if (!_PyArg_NoStackKeywords("pwrite", kwnames)) { + goto exit; + } _return_value = os_pwrite_impl(module, fd, &buffer, offset); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -4087,23 +4183,27 @@ PyDoc_STRVAR(os_makedev__doc__, "Composes a raw device number from the major and minor device numbers."); #define OS_MAKEDEV_METHODDEF \ - {"makedev", (PyCFunction)os_makedev, METH_VARARGS, os_makedev__doc__}, + {"makedev", (PyCFunction)os_makedev, METH_FASTCALL, os_makedev__doc__}, static dev_t os_makedev_impl(PyObject *module, int major, int minor); static PyObject * -os_makedev(PyObject *module, PyObject *args) +os_makedev(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int major; int minor; dev_t _return_value; - if (!PyArg_ParseTuple(args, "ii:makedev", + if (!_PyArg_ParseStack(args, nargs, "ii:makedev", &major, &minor)) { goto exit; } + + if (!_PyArg_NoStackKeywords("makedev", kwnames)) { + goto exit; + } _return_value = os_makedev_impl(module, major, minor); if ((_return_value == (dev_t)-1) && PyErr_Occurred()) { goto exit; @@ -4125,22 +4225,26 @@ PyDoc_STRVAR(os_ftruncate__doc__, "Truncate a file, specified by file descriptor, to a specific length."); #define OS_FTRUNCATE_METHODDEF \ - {"ftruncate", (PyCFunction)os_ftruncate, METH_VARARGS, os_ftruncate__doc__}, + {"ftruncate", (PyCFunction)os_ftruncate, METH_FASTCALL, os_ftruncate__doc__}, static PyObject * os_ftruncate_impl(PyObject *module, int fd, Py_off_t length); static PyObject * -os_ftruncate(PyObject *module, PyObject *args) +os_ftruncate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; Py_off_t length; - if (!PyArg_ParseTuple(args, "iO&:ftruncate", + if (!_PyArg_ParseStack(args, nargs, "iO&:ftruncate", &fd, Py_off_t_converter, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("ftruncate", kwnames)) { + goto exit; + } return_value = os_ftruncate_impl(module, fd, length); exit: @@ -4202,24 +4306,28 @@ PyDoc_STRVAR(os_posix_fallocate__doc__, "starting at offset bytes from the beginning and continuing for length bytes."); #define OS_POSIX_FALLOCATE_METHODDEF \ - {"posix_fallocate", (PyCFunction)os_posix_fallocate, METH_VARARGS, os_posix_fallocate__doc__}, + {"posix_fallocate", (PyCFunction)os_posix_fallocate, METH_FASTCALL, os_posix_fallocate__doc__}, static PyObject * os_posix_fallocate_impl(PyObject *module, int fd, Py_off_t offset, Py_off_t length); static PyObject * -os_posix_fallocate(PyObject *module, PyObject *args) +os_posix_fallocate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; Py_off_t offset; Py_off_t length; - if (!PyArg_ParseTuple(args, "iO&O&:posix_fallocate", + if (!_PyArg_ParseStack(args, nargs, "iO&O&:posix_fallocate", &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("posix_fallocate", kwnames)) { + goto exit; + } return_value = os_posix_fallocate_impl(module, fd, offset, length); exit: @@ -4245,14 +4353,14 @@ PyDoc_STRVAR(os_posix_fadvise__doc__, "POSIX_FADV_DONTNEED."); #define OS_POSIX_FADVISE_METHODDEF \ - {"posix_fadvise", (PyCFunction)os_posix_fadvise, METH_VARARGS, os_posix_fadvise__doc__}, + {"posix_fadvise", (PyCFunction)os_posix_fadvise, METH_FASTCALL, os_posix_fadvise__doc__}, static PyObject * os_posix_fadvise_impl(PyObject *module, int fd, Py_off_t offset, Py_off_t length, int advice); static PyObject * -os_posix_fadvise(PyObject *module, PyObject *args) +os_posix_fadvise(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; @@ -4260,10 +4368,14 @@ os_posix_fadvise(PyObject *module, PyObject *args) Py_off_t length; int advice; - if (!PyArg_ParseTuple(args, "iO&O&i:posix_fadvise", + if (!_PyArg_ParseStack(args, nargs, "iO&O&i:posix_fadvise", &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice)) { goto exit; } + + if (!_PyArg_NoStackKeywords("posix_fadvise", kwnames)) { + goto exit; + } return_value = os_posix_fadvise_impl(module, fd, offset, length, advice); exit: @@ -4281,22 +4393,26 @@ PyDoc_STRVAR(os_putenv__doc__, "Change or add an environment variable."); #define OS_PUTENV_METHODDEF \ - {"putenv", (PyCFunction)os_putenv, METH_VARARGS, os_putenv__doc__}, + {"putenv", (PyCFunction)os_putenv, METH_FASTCALL, os_putenv__doc__}, static PyObject * os_putenv_impl(PyObject *module, PyObject *name, PyObject *value); static PyObject * -os_putenv(PyObject *module, PyObject *args) +os_putenv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *name; PyObject *value; - if (!PyArg_ParseTuple(args, "UU:putenv", + if (!_PyArg_ParseStack(args, nargs, "UU:putenv", &name, &value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("putenv", kwnames)) { + goto exit; + } return_value = os_putenv_impl(module, name, value); exit: @@ -4314,22 +4430,26 @@ PyDoc_STRVAR(os_putenv__doc__, "Change or add an environment variable."); #define OS_PUTENV_METHODDEF \ - {"putenv", (PyCFunction)os_putenv, METH_VARARGS, os_putenv__doc__}, + {"putenv", (PyCFunction)os_putenv, METH_FASTCALL, os_putenv__doc__}, static PyObject * os_putenv_impl(PyObject *module, PyObject *name, PyObject *value); static PyObject * -os_putenv(PyObject *module, PyObject *args) +os_putenv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *name = NULL; PyObject *value = NULL; - if (!PyArg_ParseTuple(args, "O&O&:putenv", + if (!_PyArg_ParseStack(args, nargs, "O&O&:putenv", PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("putenv", kwnames)) { + goto exit; + } return_value = os_putenv_impl(module, name, value); exit: @@ -4835,23 +4955,27 @@ PyDoc_STRVAR(os_fpathconf__doc__, "If there is no limit, return -1."); #define OS_FPATHCONF_METHODDEF \ - {"fpathconf", (PyCFunction)os_fpathconf, METH_VARARGS, os_fpathconf__doc__}, + {"fpathconf", (PyCFunction)os_fpathconf, METH_FASTCALL, os_fpathconf__doc__}, static long os_fpathconf_impl(PyObject *module, int fd, int name); static PyObject * -os_fpathconf(PyObject *module, PyObject *args) +os_fpathconf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int name; long _return_value; - if (!PyArg_ParseTuple(args, "iO&:fpathconf", + if (!_PyArg_ParseStack(args, nargs, "iO&:fpathconf", &fd, conv_path_confname, &name)) { goto exit; } + + if (!_PyArg_NoStackKeywords("fpathconf", kwnames)) { + goto exit; + } _return_value = os_fpathconf_impl(module, fd, name); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -5122,23 +5246,27 @@ PyDoc_STRVAR(os_setresuid__doc__, "Set the current process\'s real, effective, and saved user ids."); #define OS_SETRESUID_METHODDEF \ - {"setresuid", (PyCFunction)os_setresuid, METH_VARARGS, os_setresuid__doc__}, + {"setresuid", (PyCFunction)os_setresuid, METH_FASTCALL, os_setresuid__doc__}, static PyObject * os_setresuid_impl(PyObject *module, uid_t ruid, uid_t euid, uid_t suid); static PyObject * -os_setresuid(PyObject *module, PyObject *args) +os_setresuid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; uid_t ruid; uid_t euid; uid_t suid; - if (!PyArg_ParseTuple(args, "O&O&O&:setresuid", + if (!_PyArg_ParseStack(args, nargs, "O&O&O&:setresuid", _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setresuid", kwnames)) { + goto exit; + } return_value = os_setresuid_impl(module, ruid, euid, suid); exit: @@ -5156,23 +5284,27 @@ PyDoc_STRVAR(os_setresgid__doc__, "Set the current process\'s real, effective, and saved group ids."); #define OS_SETRESGID_METHODDEF \ - {"setresgid", (PyCFunction)os_setresgid, METH_VARARGS, os_setresgid__doc__}, + {"setresgid", (PyCFunction)os_setresgid, METH_FASTCALL, os_setresgid__doc__}, static PyObject * os_setresgid_impl(PyObject *module, gid_t rgid, gid_t egid, gid_t sgid); static PyObject * -os_setresgid(PyObject *module, PyObject *args) +os_setresgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; gid_t rgid; gid_t egid; gid_t sgid; - if (!PyArg_ParseTuple(args, "O&O&O&:setresgid", + if (!_PyArg_ParseStack(args, nargs, "O&O&O&:setresgid", _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setresgid", kwnames)) { + goto exit; + } return_value = os_setresgid_impl(module, rgid, egid, sgid); exit: @@ -5505,22 +5637,26 @@ PyDoc_STRVAR(os_set_inheritable__doc__, "Set the inheritable flag of the specified file descriptor."); #define OS_SET_INHERITABLE_METHODDEF \ - {"set_inheritable", (PyCFunction)os_set_inheritable, METH_VARARGS, os_set_inheritable__doc__}, + {"set_inheritable", (PyCFunction)os_set_inheritable, METH_FASTCALL, os_set_inheritable__doc__}, static PyObject * os_set_inheritable_impl(PyObject *module, int fd, int inheritable); static PyObject * -os_set_inheritable(PyObject *module, PyObject *args) +os_set_inheritable(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int inheritable; - if (!PyArg_ParseTuple(args, "ii:set_inheritable", + if (!_PyArg_ParseStack(args, nargs, "ii:set_inheritable", &fd, &inheritable)) { goto exit; } + + if (!_PyArg_NoStackKeywords("set_inheritable", kwnames)) { + goto exit; + } return_value = os_set_inheritable_impl(module, fd, inheritable); exit: @@ -5572,23 +5708,27 @@ PyDoc_STRVAR(os_set_handle_inheritable__doc__, "Set the inheritable flag of the specified handle."); #define OS_SET_HANDLE_INHERITABLE_METHODDEF \ - {"set_handle_inheritable", (PyCFunction)os_set_handle_inheritable, METH_VARARGS, os_set_handle_inheritable__doc__}, + {"set_handle_inheritable", (PyCFunction)os_set_handle_inheritable, METH_FASTCALL, os_set_handle_inheritable__doc__}, static PyObject * os_set_handle_inheritable_impl(PyObject *module, intptr_t handle, int inheritable); static PyObject * -os_set_handle_inheritable(PyObject *module, PyObject *args) +os_set_handle_inheritable(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; intptr_t handle; int inheritable; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "p:set_handle_inheritable", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_INTPTR "p:set_handle_inheritable", &handle, &inheritable)) { goto exit; } + + if (!_PyArg_NoStackKeywords("set_handle_inheritable", kwnames)) { + goto exit; + } return_value = os_set_handle_inheritable_impl(module, handle, inheritable); exit: @@ -6352,4 +6492,4 @@ exit: #ifndef OS_GETRANDOM_METHODDEF #define OS_GETRANDOM_METHODDEF #endif /* !defined(OS_GETRANDOM_METHODDEF) */ -/*[clinic end generated code: output=61abf6df195aa5f1 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=30cdd28fc524f2fb input=a9049054013a1b77]*/ -- cgit v1.2.1