D10129: pycompat: fix a bytes vs str issue in `unnamedtempfile()`

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Mon Mar 8 17:29:29 UTC 2021


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

REVISION SUMMARY
  This seems trivially correct, though the only two uses I found both took this
  path.  So I'm guessing we're missing test coverage.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pycompat.py

CHANGE DETAILS

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -510,7 +510,7 @@
 # This wrapper file are always open in byte mode.
 def unnamedtempfile(mode=None, *args, **kwargs):
     if mode is None:
-        mode = b'w+b'
+        mode = 'w+b'
     else:
         mode = sysstr(mode)
     assert 'b' in mode



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


More information about the Mercurial-devel mailing list