py3: convert the mode argument of os.fdopen to unicodes
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 16 Feb 2017 17:30:35 +0530
changeset 30988 d194f0dba7ac
parent 30987 1ee685defe80
child 30989 74af89c66834
py3: convert the mode argument of os.fdopen to unicodes Couple of these from the earlier series got lost while rebasing. So this patch converts them again.
mercurial/debugcommands.py
mercurial/util.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
--- a/mercurial/util.py	Wed Feb 15 16:29:58 2017 -0800
+++ b/mercurial/util.py	Thu Feb 16 17:30:35 2017 +0530
@@ -73,7 +73,7 @@
 # destined stdout with a pipe destined stdout (e.g. pager), we want line
 # buffering
 if isatty(stdout):
-    stdout = os.fdopen(stdout.fileno(), 'wb', 1)
+    stdout = os.fdopen(stdout.fileno(), pycompat.sysstr('wb'), 1)
 
 if pycompat.osname == 'nt':
     from . import windows as platform