mirror of
https://github.com/python/cpython.git
synced 2026-04-22 03:41:08 +00:00
bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165). (GH-10947)
(cherry picked from commit 34c7f0c04e)
Co-authored-by: William Grzybowski <wg@FreeBSD.org>
This commit is contained in:
parent
1de91a0032
commit
ac8b47c8b4
3 changed files with 5 additions and 2 deletions
|
|
@ -0,0 +1,3 @@
|
|||
Fix possible mojibake in the error message of `pwd.getpwnam` and
|
||||
`grp.getgrnam` using string representation because of invisible characters
|
||||
or trailing whitespaces. Patch by William Grzybowski.
|
||||
|
|
@ -156,7 +156,7 @@ grp_getgrnam_impl(PyObject *module, PyObject *name)
|
|||
goto out;
|
||||
|
||||
if ((p = getgrnam(name_chars)) == NULL) {
|
||||
PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %S", name);
|
||||
PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %R", name);
|
||||
goto out;
|
||||
}
|
||||
retval = mkgrent(p);
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *arg)
|
|||
goto out;
|
||||
if ((p = getpwnam(name)) == NULL) {
|
||||
PyErr_Format(PyExc_KeyError,
|
||||
"getpwnam(): name not found: %S", arg);
|
||||
"getpwnam(): name not found: %R", arg);
|
||||
goto out;
|
||||
}
|
||||
retval = mkpwent(p);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue