Index: Doc/library/pwd.rst =================================================================== --- Doc/library/pwd.rst (revision 68342) +++ Doc/library/pwd.rst (working copy) @@ -32,7 +32,8 @@ | 6 | ``pw_shell`` | User command interpreter | +-------+---------------+-----------------------------+ -The uid and gid items are integers, all others are strings. :exc:`KeyError` is +The uid and gid items are integers, all others are strings produced by +decoding the relevant structure members as Latin-1 text. :exc:`KeyError` is raised if the entry asked for cannot be found. .. note:: Index: Modules/pwdmodule.c =================================================================== --- Modules/pwdmodule.c (revision 68342) +++ Modules/pwdmodule.c (working copy) @@ -38,8 +38,9 @@ Password database entries are reported as 7-tuples containing the following\n\ items from the password database (see `'), 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."); +The uid and gid items are integers, all others are strings produced by\n\ +decoding the relevant structure members as Latin-1 text. KeyError is\n\ +raised if the entry asked for cannot be found."); static int initialized; @@ -50,7 +51,7 @@ { if (val) { PyObject *o = - PyUnicode_DecodeUnicodeEscape(val, strlen(val), "strict"); + PyUnicode_DecodeLatin1(val, strlen(val), NULL); PyStructSequence_SET_ITEM(v, i, o); } else {