Patchwork D6039: py3: make sure return value of posix.groupname() is bytes

login
register
mail settings
Submitter phabricator
Date March 2, 2019, 12:13 a.m.
Message ID <differential-rev-PHID-DREV-2wbgterjcs4qwlutpeaw-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/38984/
State Superseded
Headers show

Comments

phabricator - March 2, 2019, 12:13 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6039

AFFECTED FILES
  mercurial/posix.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -575,9 +575,9 @@ 
     if gid is None:
         gid = os.getgid()
     try:
-        return grp.getgrgid(gid)[0]
+        return pycompat.fsencode(grp.getgrgid(gid)[0])
     except KeyError:
-        return str(gid)
+        return pycompat.bytestr(gid)
 
 def groupmembers(name):
     """Return the list of members of the group with the given