diff -r 1ee685defe80 -r d194f0dba7ac mercurial/debugcommands.py --- a/mercurial/debugcommands.py Wed Feb 15 16:29:58 2017 -0800 +++ b/mercurial/debugcommands.py Thu Feb 16 17:30:35 2017 +0530 @@ -910,7 +910,7 @@ def writetemp(contents): (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") - f = os.fdopen(fd, "wb") + f = os.fdopen(fd, pycompat.sysstr("wb")) f.write(contents) f.close() return name