Mercurial > hg
diff mercurial/debugcommands.py @ 38166:cc9aa88792fe
py3: wrap tempfile.NamedTemporaryFile() to return bytes fp.name
Unlike its name, tempfile.NamedTemporaryFile is not a class, so I renamed
the pycompat version to look like a plain function.
Since temp.name uses in the infinitepush extension aren't bytes-safe, this
patch leaves them unmodified. Another weird thing is tempfile.mktemp(),
which does not accept bytes suffix nor prefix. Sigh.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 26 May 2018 12:38:07 +0900 |
parents | aac4be30e250 |
children | ead71b15efd5 |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Sat May 26 12:20:36 2018 +0900 +++ b/mercurial/debugcommands.py Sat May 26 12:38:07 2018 +0900 @@ -21,7 +21,6 @@ import string import subprocess import sys -import tempfile import time from .i18n import _ @@ -970,7 +969,7 @@ ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) casesensitive = '(unknown)' try: - with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f: + with pycompat.namedtempfile(prefix='.debugfsinfo', dir=path) as f: casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no' except OSError: pass