Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 38164: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 | 6acf41bb8d40 |
children | bec1212eceaa |
comparison
equal
deleted
inserted
replaced
38163:b39958d6b81b | 38164:aac4be30e250 |
---|---|
16 import re | 16 import re |
17 import signal | 17 import signal |
18 import socket | 18 import socket |
19 import subprocess | 19 import subprocess |
20 import sys | 20 import sys |
21 import tempfile | |
22 import traceback | 21 import traceback |
23 | 22 |
24 from .i18n import _ | 23 from .i18n import _ |
25 from .node import hex | 24 from .node import hex |
26 | 25 |
1444 suffix = extra['suffix'] | 1443 suffix = extra['suffix'] |
1445 | 1444 |
1446 rdir = None | 1445 rdir = None |
1447 if self.configbool('experimental', 'editortmpinhg'): | 1446 if self.configbool('experimental', 'editortmpinhg'): |
1448 rdir = repopath | 1447 rdir = repopath |
1449 (fd, name) = tempfile.mkstemp(prefix='hg-' + extra['prefix'] + '-', | 1448 (fd, name) = pycompat.mkstemp(prefix='hg-' + extra['prefix'] + '-', |
1450 suffix=suffix, | 1449 suffix=suffix, |
1451 dir=rdir) | 1450 dir=rdir) |
1452 try: | 1451 try: |
1453 f = os.fdopen(fd, r'wb') | 1452 f = os.fdopen(fd, r'wb') |
1454 f.write(util.tonativeeol(text)) | 1453 f.write(util.tonativeeol(text)) |