Patchwork D2170: py3: make dummyssh compatible with Python 3

login
register
mail settings
Submitter phabricator
Date Feb. 12, 2018, 3:45 a.m.
Message ID <differential-rev-PHID-DREV-xys7je4hcyarssixyhoi-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27638/
State Superseded
Headers show

Comments

phabricator - Feb. 12, 2018, 3:45 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Required encoding a str to bytes and writing bytes to a file
  descriptor.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/dummyssh

CHANGE DETAILS




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

Patch

diff --git a/tests/dummyssh b/tests/dummyssh
--- a/tests/dummyssh
+++ b/tests/dummyssh
@@ -15,8 +15,8 @@ 
 log = open("dummylog", "ab")
 log.write(b"Got arguments")
 for i, arg in enumerate(sys.argv[1:]):
-    log.write(b" %d:%s" % (i + 1, arg))
-log.write("\n")
+    log.write(b" %d:%s" % (i + 1, arg.encode('latin1')))
+log.write(b"\n")
 log.close()
 hgcmd = sys.argv[2]
 if os.name == 'nt':