Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/pycompat.py @ 45726:d1072cba8aff
pycompat: update comment about unnamedtempfile
I found the comment clearer. I end up having to think about this for
`TemporaryFile` and I update that one in the process.
Differential Revision: https://phab.mercurial-scm.org/D9210
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 14 Oct 2020 21:47:14 +0200 |
parents | 9694895749ad |
children | d4c4391aa7f2 |
comparison
equal
deleted
inserted
replaced
45725:99b8b73eb622 | 45726:d1072cba8aff |
---|---|
504 # text=True is not supported; use util.from/tonativeeol() instead | 504 # text=True is not supported; use util.from/tonativeeol() instead |
505 def mkstemp(suffix=b'', prefix=b'tmp', dir=None): | 505 def mkstemp(suffix=b'', prefix=b'tmp', dir=None): |
506 return tempfile.mkstemp(suffix, prefix, dir) | 506 return tempfile.mkstemp(suffix, prefix, dir) |
507 | 507 |
508 | 508 |
509 # mode must include 'b'ytes as encoding= is not supported | 509 # NamedTemporaryFile does not support an "encoding=" argument on python2. |
510 # This wrapper file are always open in byte mode. | |
510 def namedtempfile( | 511 def namedtempfile( |
511 mode=b'w+b', bufsize=-1, suffix=b'', prefix=b'tmp', dir=None, delete=True | 512 mode=b'w+b', bufsize=-1, suffix=b'', prefix=b'tmp', dir=None, delete=True |
512 ): | 513 ): |
513 mode = sysstr(mode) | 514 mode = sysstr(mode) |
514 assert 'b' in mode | 515 assert 'b' in mode |