[Jython-checkins] jython: Merged https://github.com/jythontools/jython/pull/57 to fix #2534.

stefan.richthofer jython-checkins at python.org
Fri Feb 24 06:18:38 EST 2017


https://hg.python.org/jython/rev/07724b0547e0
changeset:   8030:07724b0547e0
user:        James Mudd <james.mudd at gmail.com>
date:        Fri Feb 24 12:18:23 2017 +0100
summary:
  Merged https://github.com/jythontools/jython/pull/57 to fix #2534.

files:
  src/org/python/modules/posix/PosixModule.java |  7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/src/org/python/modules/posix/PosixModule.java b/src/org/python/modules/posix/PosixModule.java
--- a/src/org/python/modules/posix/PosixModule.java
+++ b/src/org/python/modules/posix/PosixModule.java
@@ -525,7 +525,12 @@
         "Return the actual login name.");
     @Hide(value=OS.NT, posixImpl = PosixImpl.JAVA)
     public static PyObject getlogin() {
-        return new PyString(posix.getlogin());
+        String login = posix.getlogin();
+        if (login == null) {
+            throw Py.OSError(
+                    "getlogin OS call failed. Preferentially use os.getenv('LOGNAME') instead.");
+        }
+        return new PyString(login);
     }
 
     public static PyString __doc__getppid = new PyString(

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list