Mercurial > public > mercurial-scm > hg-stable
diff mercurial/pycompat.py @ 38197:aac4be30e250
py3: wrap tempfile.mkstemp() to use bytes path
This patch just flips the default to use a bytes path on Python 3.
ca1cf9b3cce7 is backed out as the bundlepath should be bytes now.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 26 May 2018 12:14:04 +0900 |
parents | 8fb9985382be |
children | 2ce60954b1b7 |
line wrap: on
line diff
--- a/mercurial/pycompat.py Thu May 03 18:39:58 2018 +0900 +++ b/mercurial/pycompat.py Sat May 26 12:14:04 2018 +0900 @@ -15,6 +15,7 @@ import os import shlex import sys +import tempfile ispy3 = (sys.version_info[0] >= 3) ispypy = (r'__pypy__' in sys.builtin_module_names) @@ -384,3 +385,7 @@ def gnugetoptb(args, shortlist, namelist): return _getoptbwrapper(getopt.gnu_getopt, args, shortlist, namelist) + +# text=True is not supported; use util.from/tonativeeol() instead +def mkstemp(suffix=b'', prefix=b'tmp', dir=None): + return tempfile.mkstemp(suffix, prefix, dir)