pwdmodule.c.h 2.1 KB

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