From patchwork Thu Sep 27 03:12:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4,of,4] py3: convert os.readlink() path to native strings From: Matt Harbison X-Patchwork-Id: 35131 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Wed, 26 Sep 2018 23:12:56 -0400 # HG changeset patch # User Matt Harbison # Date 1537924572 14400 # Tue Sep 25 21:16:12 2018 -0400 # Node ID d7aa84fbb3da463c68190aa746cbc6af40c6b8bc # Parent 549bc25529a2d8d1c67736110c90491cc1eafc76 py3: convert os.readlink() path to native strings Windows insisted that it needs to be str. I skipped the stuff that's obviously posix only, and left `tests/f` and `run-tests.py` alone for now. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1841,7 +1841,7 @@ def makelock(info, pathname): def readlock(pathname): try: - return os.readlink(pathname) + return os.readlink(pycompat.fsdecode(pathname)) except OSError as why: if why.errno not in (errno.EINVAL, errno.ENOSYS): raise diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -206,7 +206,7 @@ class abstractvfs(object): return util.rename(srcpath, dstpath) def readlink(self, path): - return os.readlink(self.join(path)) + return os.readlink(pycompat.fsdecode(self.join(path))) def removedirs(self, path=None): """Remove a leaf directory and all empty intermediate ones