D7517: filemerge: byteify the open() mode

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Sun Nov 24 05:45:24 UTC 2019


mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is actually `pycompat.open()`, so it need bytes.  It regressed recently on
  default.
  
  VSCode flagged some invalid mode to open() the other day, but I don't remember
  where.  That's what got me searching in this area.  I'm almost certain that it
  was the other way (i.e. saying open doesn't take bytes), but I can't find that
  now.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -934,7 +934,7 @@
             name = os.path.join(tmproot, pre)
             if ext:
                 name += ext
-            f = open(name, "wb")
+            f = open(name, b"wb")
         else:
             fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext)
             f = os.fdopen(fd, "wb")



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


More information about the Mercurial-devel mailing list