diff mercurial/patch.py @ 36046:a5cf79755eff

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 14:18:27 -0800
parents 04984f2e50ae
children eb91ffdaaece
line wrap: on
line diff
--- 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)