diff -r 47b9240615ca -r a4aa77b84efd mercurial/posix.py --- 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.