D5808: py3: do a fsdecode(), fsencode() dance in posix.py

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sun Feb 3 07:13:11 EST 2019


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We have to use `fsdecode()` instead of sysstr() because they are abusing
  `PyUnicode_EncodeFSDefault()` to get back bytes.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/posix.py

CHANGE DETAILS

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -583,8 +583,8 @@
     """Return the list of members of the group with the given
     name, KeyError if the group does not exist.
     """
-    name = pycompat.sysstr(name)
-    return list(grp.getgrnam(name).gr_mem)
+    name = pycompat.fsdecode(name)
+    return pycompat.rapply(pycompat.fsencode, list(grp.getgrnam(name).gr_mem))
 
 def spawndetached(args):
     return os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0),



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


More information about the Mercurial-devel mailing list