Mercurial > hg > mercurial-source
comparison mercurial/pycompat.py @ 38950: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 |
comparison
equal
deleted
inserted
replaced
38949:b39958d6b81b | 38950:aac4be30e250 |
---|---|
13 import getopt | 13 import getopt |
14 import inspect | 14 import inspect |
15 import os | 15 import os |
16 import shlex | 16 import shlex |
17 import sys | 17 import sys |
18 import tempfile | |
18 | 19 |
19 ispy3 = (sys.version_info[0] >= 3) | 20 ispy3 = (sys.version_info[0] >= 3) |
20 ispypy = (r'__pypy__' in sys.builtin_module_names) | 21 ispypy = (r'__pypy__' in sys.builtin_module_names) |
21 | 22 |
22 if not ispy3: | 23 if not ispy3: |
382 def getoptb(args, shortlist, namelist): | 383 def getoptb(args, shortlist, namelist): |
383 return _getoptbwrapper(getopt.getopt, args, shortlist, namelist) | 384 return _getoptbwrapper(getopt.getopt, args, shortlist, namelist) |
384 | 385 |
385 def gnugetoptb(args, shortlist, namelist): | 386 def gnugetoptb(args, shortlist, namelist): |
386 return _getoptbwrapper(getopt.gnu_getopt, args, shortlist, namelist) | 387 return _getoptbwrapper(getopt.gnu_getopt, args, shortlist, namelist) |
388 | |
389 # text=True is not supported; use util.from/tonativeeol() instead | |
390 def mkstemp(suffix=b'', prefix=b'tmp', dir=None): | |
391 return tempfile.mkstemp(suffix, prefix, dir) |