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

login
register
mail settings
Submitter phabricator
Date March 8, 2021, 5:29 p.m.
Message ID <differential-rev-PHID-DREV-2wkf4dygmnzcmdoet4pd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48444/
State Superseded
Headers show

Comments

phabricator - March 8, 2021, 5:29 p.m.
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




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

Patch

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