mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Issue #9605: posix.getlogin() decodes the username with file filesystem
encoding and surrogateescape error handler. Patch written by David Watson. Reindent also posix_getlogin(), and fix a typo in the NEWS file.
This commit is contained in:
parent
61ec5dca2b
commit
e039ffe41d
2 changed files with 7 additions and 5 deletions
|
@ -4354,13 +4354,12 @@ posix_getlogin(PyObject *self, PyObject *noargs)
|
|||
name = getlogin();
|
||||
if (name == NULL) {
|
||||
if (errno)
|
||||
posix_error();
|
||||
posix_error();
|
||||
else
|
||||
PyErr_SetString(PyExc_OSError,
|
||||
"unable to determine login name");
|
||||
PyErr_SetString(PyExc_OSError, "unable to determine login name");
|
||||
}
|
||||
else
|
||||
result = PyUnicode_FromString(name);
|
||||
result = PyUnicode_DecodeFSDefault(name);
|
||||
errno = old_errno;
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue