D2259: py3: use pycompat.bytestr to convert int/bytes to bytes

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Feb 14 11:25:02 UTC 2018


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

REVISION SUMMARY
  The item value can be integer or can be bytes, so cannot use "%d" here.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/worker.py

CHANGE DETAILS

diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -156,7 +156,7 @@
                 def workerfunc():
                     os.close(rfd)
                     for i, item in func(*(staticargs + (pargs,))):
-                        os.write(wfd, '%d %s\n' % (i, item))
+                        os.write(wfd, '%d %s\n' % (i, pycompat.bytestr(item)))
                     return 0
 
                 ret = scmutil.callcatch(ui, workerfunc)



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


More information about the Mercurial-devel mailing list