Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 34c7f0c

Browse files
william-grserhiy-storchaka
authored andcommitted
bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165)
1 parent 25d3897 commit 34c7f0c

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Fix possible mojibake in the error message of `pwd.getpwnam` and
2-
`grp.getgrnam`. Patch by William Grzybowski.
2+
`grp.getgrnam` using string representation because of invisible characters
3+
or trailing whitespaces. Patch by William Grzybowski.

Modules/grpmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ grp_getgrnam_impl(PyObject *module, PyObject *name)
247247
PyErr_NoMemory();
248248
}
249249
else {
250-
PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %S", name);
250+
PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %R", name);
251251
}
252252
goto out;
253253
}

Modules/pwdmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *name)
257257
}
258258
else {
259259
PyErr_Format(PyExc_KeyError,
260-
"getpwnam(): name not found: %S", name);
260+
"getpwnam(): name not found: %R", name);
261261
}
262262
goto out;
263263
}

0 commit comments

Comments
 (0)