1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(pwd_getpwuid__doc__,
6 "getpwuid($module, uidobj, /)\n"
7 "--\n"
8 "\n"
9 "Return the password database entry for the given numeric user ID.\n"
10 "\n"
11 "See `help(pwd)` for more on password database entries.");
12 
13 #define PWD_GETPWUID_METHODDEF    \
14     {"getpwuid", (PyCFunction)pwd_getpwuid, METH_O, pwd_getpwuid__doc__},
15 
16 PyDoc_STRVAR(pwd_getpwnam__doc__,
17 "getpwnam($module, name, /)\n"
18 "--\n"
19 "\n"
20 "Return the password database entry for the given user name.\n"
21 "\n"
22 "See `help(pwd)` for more on password database entries.");
23 
24 #define PWD_GETPWNAM_METHODDEF    \
25     {"getpwnam", (PyCFunction)pwd_getpwnam, METH_O, pwd_getpwnam__doc__},
26 
27 static PyObject *
28 pwd_getpwnam_impl(PyObject *module, PyObject *name);
29 
30 static PyObject *
pwd_getpwnam(PyObject * module,PyObject * arg)31 pwd_getpwnam(PyObject *module, PyObject *arg)
32 {
33     PyObject *return_value = NULL;
34     PyObject *name;
35 
36     if (!PyUnicode_Check(arg)) {
37         _PyArg_BadArgument("getpwnam", "argument", "str", arg);
38         goto exit;
39     }
40     if (PyUnicode_READY(arg) == -1) {
41         goto exit;
42     }
43     name = arg;
44     return_value = pwd_getpwnam_impl(module, name);
45 
46 exit:
47     return return_value;
48 }
49 
50 #if defined(HAVE_GETPWENT)
51 
52 PyDoc_STRVAR(pwd_getpwall__doc__,
53 "getpwall($module, /)\n"
54 "--\n"
55 "\n"
56 "Return a list of all available password database entries, in arbitrary order.\n"
57 "\n"
58 "See help(pwd) for more on password database entries.");
59 
60 #define PWD_GETPWALL_METHODDEF    \
61     {"getpwall", (PyCFunction)pwd_getpwall, METH_NOARGS, pwd_getpwall__doc__},
62 
63 static PyObject *
64 pwd_getpwall_impl(PyObject *module);
65 
66 static PyObject *
pwd_getpwall(PyObject * module,PyObject * Py_UNUSED (ignored))67 pwd_getpwall(PyObject *module, PyObject *Py_UNUSED(ignored))
68 {
69     return pwd_getpwall_impl(module);
70 }
71 
72 #endif /* defined(HAVE_GETPWENT) */
73 
74 #ifndef PWD_GETPWALL_METHODDEF
75     #define PWD_GETPWALL_METHODDEF
76 #endif /* !defined(PWD_GETPWALL_METHODDEF) */
77 /*[clinic end generated code: output=7fceab7f1a85da36 input=a9049054013a1b77]*/
78