changeset 38252:a4aa77b84efd

py3: make sure util.username() always returns bytes Differential Revision: https://phab.mercurial-scm.org/D3706
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 09 Jun 2018 15:14:31 +0530
parents 47b9240615ca
children 1b121cc680f2
files mercurial/posix.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Sat Jun 09 15:01:04 2018 +0530
+++ b/mercurial/posix.py	Sat Jun 09 15:14:31 2018 +0530
@@ -541,9 +541,9 @@
     if uid is None:
         uid = os.getuid()
     try:
-        return pwd.getpwuid(uid)[0]
+        return pycompat.fsencode(pwd.getpwuid(uid)[0])
     except KeyError:
-        return str(uid)
+        return b'%d' % uid
 
 def groupname(gid=None):
     """Return the name of the group with the given gid.