mercurial/patch.py
changeset 30924 48dea083f66d
parent 30819 897726622877
child 31198 71a6723c0029
--- a/mercurial/patch.py	Thu Feb 09 15:20:41 2017 -0500
+++ b/mercurial/patch.py	Mon Feb 13 20:06:38 2017 +0530
@@ -34,6 +34,7 @@
     mail,
     mdiff,
     pathutil,
+    pycompat,
     scmutil,
     similar,
     util,
@@ -209,7 +210,7 @@
 
     data = {}
     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
-    tmpfp = os.fdopen(fd, 'w')
+    tmpfp = os.fdopen(fd, pycompat.sysstr('w'))
     try:
         msg = email.Parser.Parser().parse(fileobj)
 
@@ -1055,7 +1056,7 @@
                 ncpatchfp = None
                 try:
                     # Write the initial patch
-                    f = os.fdopen(patchfd, "w")
+                    f = os.fdopen(patchfd, pycompat.sysstr("w"))
                     chunk.header.write(f)
                     chunk.write(f)
                     f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))