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