py3: open temporary file in binary mode
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 11 Feb 2018 14:18:27 -0800
changeset 36046 a5cf79755eff
parent 36045 04984f2e50ae
child 36047 1407c42b302c
py3: open temporary file in binary mode Otherwise things fail later when we write bytes to the handle. Differential Revision: https://phab.mercurial-scm.org/D2148
mercurial/patch.py
--- a/mercurial/patch.py	Sun Feb 11 14:17:23 2018 -0800
+++ b/mercurial/patch.py	Sun Feb 11 14:18:27 2018 -0800
@@ -215,7 +215,7 @@
 
     data = {}
     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
-    tmpfp = os.fdopen(fd, pycompat.sysstr('w'))
+    tmpfp = os.fdopen(fd, pycompat.sysstr('wb'))
     try:
         msg = pycompat.emailparser().parse(fileobj)