From 85675994e68263420588a9257cb7450b7138574c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 15 Aug 2010 09:35:13 +0000 Subject: [PATCH] Merged revisions 84063 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ........ r84063 | victor.stinner | 2010-08-15 11:33:08 +0200 (dim., 15 août 2010) | 5 lines 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. ........ --- Misc/NEWS | 3 +++ Modules/posixmodule.c | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 81d3e81c54..83ddaaa950 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -93,6 +93,9 @@ C-API Library ------- +- Issue #9605: posix.getlogin() decodes the username with file filesystem + encoding and surrogateescape error handler. Patch written by David Watson. + - Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name using the filesystem encoding and surrogateescape error handler. Patch written by David Watson. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6d92544982..ef91dab010 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4144,13 +4144,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; -- 2.40.0