summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorWilliam Grzybowski <wg@FreeBSD.org>2018-09-07 17:10:39 (GMT)
committerVictor Stinner <vstinner@redhat.com>2018-09-07 17:10:39 (GMT)
commit28658485a54ad5f9df52ecc12d9046269f1654ec (patch)
tree37481555ef2aabc3af2c325ef4b6c6c65e2662ef /Modules/clinic
parent7e610bcdf128f61b925654e4fa80fbac83537d0e (diff)
downloadcpython-28658485a54ad5f9df52ecc12d9046269f1654ec.zip
cpython-28658485a54ad5f9df52ecc12d9046269f1654ec.tar.gz
cpython-28658485a54ad5f9df52ecc12d9046269f1654ec.tar.bz2
bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098)
Pass the user/group name as Unicode to the formatting function, instead of always decoding a bytes string from UTF-8.
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/pwdmodule.c.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/Modules/clinic/pwdmodule.c.h b/Modules/clinic/pwdmodule.c.h
index f9e0644..979dfdb 100644
--- a/Modules/clinic/pwdmodule.c.h
+++ b/Modules/clinic/pwdmodule.c.h
@@ -14,7 +14,7 @@ PyDoc_STRVAR(pwd_getpwuid__doc__,
{"getpwuid", (PyCFunction)pwd_getpwuid, METH_O, pwd_getpwuid__doc__},
PyDoc_STRVAR(pwd_getpwnam__doc__,
-"getpwnam($module, arg, /)\n"
+"getpwnam($module, name, /)\n"
"--\n"
"\n"
"Return the password database entry for the given user name.\n"
@@ -25,18 +25,18 @@ PyDoc_STRVAR(pwd_getpwnam__doc__,
{"getpwnam", (PyCFunction)pwd_getpwnam, METH_O, pwd_getpwnam__doc__},
static PyObject *
-pwd_getpwnam_impl(PyObject *module, PyObject *arg);
+pwd_getpwnam_impl(PyObject *module, PyObject *name);
static PyObject *
-pwd_getpwnam(PyObject *module, PyObject *arg_)
+pwd_getpwnam(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
- PyObject *arg;
+ PyObject *name;
- if (!PyArg_Parse(arg_, "U:getpwnam", &arg)) {
+ if (!PyArg_Parse(arg, "U:getpwnam", &name)) {
goto exit;
}
- return_value = pwd_getpwnam_impl(module, arg);
+ return_value = pwd_getpwnam_impl(module, name);
exit:
return return_value;
@@ -69,4 +69,4 @@ pwd_getpwall(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef PWD_GETPWALL_METHODDEF
#define PWD_GETPWALL_METHODDEF
#endif /* !defined(PWD_GETPWALL_METHODDEF) */
-/*[clinic end generated code: output=fc41d8d88ec206d8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3c93120d6dd86905 input=a9049054013a1b77]*/