Patchwork D2148: py3: open temporary file in binary mode

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2018, 10:58 p.m.
Message ID <differential-rev-PHID-DREV-fsq7fl5si57lzvqldmmk-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27598/
State Superseded
Headers show

Comments

phabricator - Feb. 11, 2018, 10:58 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Otherwise things fail later when we write bytes to the handle.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2148

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -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)