From 0deec7f438535e713e99824e7d1700480b9e79f9 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Tue, 23 Aug 2022 04:44:31 +0200 Subject: [PATCH 1/3] gh-96192: fix os.ismount() to use a path that is str or bytes Co-authored-by: Eryk Sun Signed-off-by: Christoph Anton Mitterer --- Lib/posixpath.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 5e1ebe3293d849..5b4d78bca06132 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -195,6 +195,7 @@ def ismount(path): if stat.S_ISLNK(s1.st_mode): return False + path = os.fspath(path) if isinstance(path, bytes): parent = join(path, b'..') else: From 8789b64aa1846ec5d3c4b201cbf47010979229b9 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 03:13:19 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jelle Zijlstra Signed-off-by: Christoph Anton Mitterer --- .../next/Library/2022-08-23-03-13-18.gh-issue-96192.TJywOF.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2022-08-23-03-13-18.gh-issue-96192.TJywOF.rst diff --git a/Misc/NEWS.d/next/Library/2022-08-23-03-13-18.gh-issue-96192.TJywOF.rst b/Misc/NEWS.d/next/Library/2022-08-23-03-13-18.gh-issue-96192.TJywOF.rst new file mode 100644 index 00000000000000..58e51da6ba3993 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-08-23-03-13-18.gh-issue-96192.TJywOF.rst @@ -0,0 +1 @@ +Fix handling of ``bytes`` :term:`path-like objects ` in :func:`os.ismount()`. From a1aac8919a04cc68a1a764ad53496d2942399035 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Sun, 13 Nov 2022 23:36:35 +0100 Subject: [PATCH 3/3] gh-96192: test whether ismount works with bytes PathLike objects Co-authored-by: Jelle Zijlstra Signed-off-by: Christoph Anton Mitterer --- Lib/test/test_posixpath.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index c644f881e460fe..8a1dd131928cff 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -178,6 +178,8 @@ def test_islink(self): def test_ismount(self): self.assertIs(posixpath.ismount("/"), True) self.assertIs(posixpath.ismount(b"/"), True) + self.assertIs(posixpath.ismount(FakePath("/")), True) + self.assertIs(posixpath.ismount(FakePath(b"/")), True) def test_ismount_non_existent(self): # Non-existent mountpoint.