#include "pyconfig.h"
#ifndef Py_GIL_DISABLED
#define Py_LIMITED_API …
#endif
#include "Python.h"
#include "posixmodule.h"
#include <errno.h>
#include <pwd.h>
#include <unistd.h>
#include "clinic/pwdmodule.c.h"
static PyStructSequence_Field struct_pwd_type_fields[] = …;
PyDoc_STRVAR(struct_passwd__doc__,
"pwd.struct_passwd: Results from getpw*() routines.\n\n\
This object may be accessed either as a tuple of\n\
(pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell)\n\
or via the object attributes as named in the above tuple.");
static PyStructSequence_Desc struct_pwd_type_desc = …;
PyDoc_STRVAR(pwd__doc__,
"This module provides access to the Unix password database.\n\
It is available on all Unix versions.\n\
\n\
Password database entries are reported as 7-tuples containing the following\n\
items from the password database (see `<pwd.h>'), in order:\n\
pw_name, pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell.\n\
The uid and gid items are integers, all others are strings. An\n\
exception is raised if the entry asked for cannot be found.");
pwdmodulestate;
static inline pwdmodulestate*
get_pwd_state(PyObject *module)
{ … }
static struct PyModuleDef pwdmodule;
#define DEFAULT_BUFFER_SIZE …
static PyObject *
mkpwent(PyObject *module, struct passwd *p)
{ … }
static PyObject *
pwd_getpwuid(PyObject *module, PyObject *uidobj)
{ … }
static PyObject *
pwd_getpwnam_impl(PyObject *module, PyObject *name)
{ … }
#ifdef HAVE_GETPWENT
static PyObject *
pwd_getpwall_impl(PyObject *module)
{ … }
#endif
static PyMethodDef pwd_methods[] = …;
static int
pwdmodule_exec(PyObject *module)
{ … }
static PyModuleDef_Slot pwdmodule_slots[] = …;
static int pwdmodule_traverse(PyObject *m, visitproc visit, void *arg) { … }
static int pwdmodule_clear(PyObject *m) { … }
static void pwdmodule_free(void *m) { … }
static struct PyModuleDef pwdmodule = …;
PyMODINIT_FUNC
PyInit_pwd(void)
{ … }