diff -r 78de43ab585f -r 48dea083f66d mercurial/httppeer.py --- a/mercurial/httppeer.py Thu Feb 09 15:20:41 2017 -0500 +++ b/mercurial/httppeer.py Mon Feb 13 20:06:38 2017 +0530 @@ -20,6 +20,7 @@ bundle2, error, httpconnection, + pycompat, statichttprepo, url, util, @@ -327,7 +328,7 @@ try: # dump bundle to disk fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") - fh = os.fdopen(fd, "wb") + fh = os.fdopen(fd, pycompat.sysstr("wb")) d = fp.read(4096) while d: fh.write(d)