D2148: py3: open temporary file in binary mode

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sun Feb 11 22:58:00 UTC 2018


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

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)
 



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


More information about the Mercurial-devel mailing list