Mercurial > public > mercurial-scm > hg
diff mercurial/util.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 | 59f1e33f74a6 |
children | 565074cc9ac6 |
line wrap: on
line diff
--- a/mercurial/util.py Thu May 03 18:39:58 2018 +0900 +++ b/mercurial/util.py Sat May 26 12:14:04 2018 +0900 @@ -31,7 +31,6 @@ import socket import stat import sys -import tempfile import time import traceback import warnings @@ -1893,7 +1892,7 @@ # work around issue2543 (or testfile may get lost on Samba shares) f1, f2, fp = None, None, None try: - fd, f1 = tempfile.mkstemp(prefix='.%s-' % os.path.basename(testfile), + fd, f1 = pycompat.mkstemp(prefix='.%s-' % os.path.basename(testfile), suffix='1~', dir=os.path.dirname(testfile)) os.close(fd) f2 = '%s2~' % f1[:-2] @@ -1939,7 +1938,7 @@ Returns the name of the temporary file. """ d, fn = os.path.split(name) - fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, suffix='~', dir=d) + fd, temp = pycompat.mkstemp(prefix='.%s-' % fn, suffix='~', dir=d) os.close(fd) # Temporary files are created with mode 0600, which is usually not # what we want. If the original file already exists, just copy