[Python-checkins] r84064 - in python/branches/release31-maint: Misc/NEWS Modules/posixmodule.c

victor.stinner python-checkins at python.org
Sun Aug 15 11:35:13 CEST 2010


Author: victor.stinner
Date: Sun Aug 15 11:35:13 2010
New Revision: 84064

Log:
Merged revisions 84063 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  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.
........


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Misc/NEWS
   python/branches/release31-maint/Modules/posixmodule.c

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Sun Aug 15 11:35:13 2010
@@ -93,6 +93,9 @@
 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.

Modified: python/branches/release31-maint/Modules/posixmodule.c
==============================================================================
--- python/branches/release31-maint/Modules/posixmodule.c	(original)
+++ python/branches/release31-maint/Modules/posixmodule.c	Sun Aug 15 11:35:13 2010
@@ -4144,13 +4144,12 @@
     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;


More information about the Python-checkins mailing list