Mercurial > hg-stable
changeset 31513:53575feed7c0
posix: tiptoe around tempfile module more delicately
Some of the values inside the tempfile calls here are str on Python 3,
so we've got to pass str in. Use fsdecode to work around the issue.
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 19 Mar 2017 01:06:47 -0400 |
parents | d96d010be4fa |
children | 4d1dd9cf0dca |
files | mercurial/posix.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/posix.py Sun Mar 19 01:05:48 2017 -0400 +++ b/mercurial/posix.py Sun Mar 19 01:06:47 2017 -0400 @@ -230,13 +230,16 @@ else: checkdir = path cachedir = None - name = tempfile.mktemp(dir=checkdir, prefix='checklink-') + fscheckdir = pycompat.fsdecode(checkdir) + name = tempfile.mktemp(dir=fscheckdir, + prefix=r'checklink-') + name = pycompat.fsencode(name) try: fd = None if cachedir is None: - fd = tempfile.NamedTemporaryFile(dir=checkdir, - prefix='hg-checklink-') - target = os.path.basename(fd.name) + fd = tempfile.NamedTemporaryFile(dir=fscheckdir, + prefix=r'hg-checklink-') + target = pycompat.fsencode(os.path.basename(fd.name)) else: # create a fixed file to link to; doesn't matter if it # already exists.