Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix handling of ``bytes`` :term:`path-like objects <path-like object>` in :func:`os.ismount()`.