]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #9605: posix.getlogin() decodes the username with file filesystem
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 15 Aug 2010 09:33:08 +0000 (09:33 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 15 Aug 2010 09:33:08 +0000 (09:33 +0000)
encoding and surrogateescape error handler. Patch written by David Watson.

Reindent also posix_getlogin(), and fix a typo in the NEWS file.

Misc/NEWS
Modules/posixmodule.c

index a322b3df1612decf04affd588c5ca4c6985bc8ae..66942340e35cc011f3d6b849c7723be34e0667bc 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -83,6 +83,9 @@ Extensions
 Library
 -------
 
+- Issue #9605: posix.getlogin() decodes the username with file filesystem
+  encoding and surrogateescape error handler. Patch written by David Watson.
+
 - Issue #9604: posix.initgroups() encodes the username using the fileystem
   encoding and surrogateescape error handler. Patch written by David Watson.
 
@@ -317,7 +320,7 @@ Core and Builtins
   Fix a crash if an empty directory called "encodings" exists in sys.path.
 
 - Issue #8589: Decode PYTHONWARNINGS environment variable with the file system
-  encoding and surrogateespace error handler instead of the locale encoding to
+  encoding and surrogateescape error handler instead of the locale encoding to
   be consistent with os.environ.  Add PySys_AddWarnOptionUnicode() function.
 
 - PyObject_Dump() encodes unicode objects to utf8 with backslashreplace (instead
index 71512896ecd766aaf4d8601ef0912f693d7772f9..73fab71ee212785723884a07d6efe29ee097e719 100644 (file)
@@ -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;