Skip to content

Commit 0076ca4

Browse files
miss-islingtoncalestyoeryksunJelleZijlstra
authored
gh-96192: fix os.ismount() to use a path that is str or bytes (GH-96194)
(cherry picked from commit 367f552) Co-authored-by: Christoph Anton Mitterer <calestyo@scientia.org> Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name> Co-authored-by: Eryk Sun <eryksun@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent f4511d3 commit 0076ca4

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

Lib/posixpath.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def ismount(path):
195195
if stat.S_ISLNK(s1.st_mode):
196196
return False
197197

198+
path = os.fspath(path)
198199
if isinstance(path, bytes):
199200
parent = join(path, b'..')
200201
else:

Lib/test/test_posixpath.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def test_islink(self):
178178
def test_ismount(self):
179179
self.assertIs(posixpath.ismount("/"), True)
180180
self.assertIs(posixpath.ismount(b"/"), True)
181+
self.assertIs(posixpath.ismount(FakePath("/")), True)
182+
self.assertIs(posixpath.ismount(FakePath(b"/")), True)
181183

182184
def test_ismount_non_existent(self):
183185
# Non-existent mountpoint.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix handling of ``bytes`` :term:`path-like objects <path-like object>` in :func:`os.ismount()`.

0 commit comments

Comments
 (0)