D7621: pycompat: allow pycompat.sysbytes() even if input already is bytes

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Dec 14 22:11:09 EST 2019


Closed by commit rHG66af68d4c751: pycompat: allow pycompat.sysbytes() even if input already is bytes (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7621?vs=18651&id=18730

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7621/new/

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

AFFECTED FILES
  mercurial/pycompat.py

CHANGE DETAILS

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -253,6 +253,8 @@
         This never raises UnicodeEncodeError, but only ASCII characters
         can be round-trip by sysstr(sysbytes(s)).
         """
+        if isinstance(s, bytes):
+            return s
         return s.encode('utf-8')
 
     def sysstr(s):



To: martinvonz, #hg-reviewers, dlax, indygreg
Cc: mercurial-devel


More information about the Mercurial-devel mailing list