Patchwork D9210: pycompat: update comment about unnamedtempfile

login
register
mail settings
Submitter phabricator
Date Oct. 14, 2020, 11:34 p.m.
Message ID <differential-rev-PHID-DREV-iyxrcbnbyjcuswrtofc6-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47467/
State Superseded
Headers show

Comments

phabricator - Oct. 14, 2020, 11:34 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I found the comment clearer. I end up having to think about this for
  `TemporaryFile` and I update that one in the process.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pycompat.py

CHANGE DETAILS




To: marmoute, #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
@@ -506,7 +506,8 @@ 
     return tempfile.mkstemp(suffix, prefix, dir)
 
 
-# mode must include 'b'ytes as encoding= is not supported
+# NamedTemporaryFile does not support an "encoding=" argument on python2.
+# This wrapper file are always open in byte mode.
 def namedtempfile(
     mode=b'w+b', bufsize=-1, suffix=b'', prefix=b'tmp', dir=None, delete=True
 ):