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

Skip to content

[3.11] gh-96192: fix os.ismount() to use a path that is str or bytes (GH-96194) #99455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2022
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
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 <[email protected]>
Signed-off-by: Christoph Anton Mitterer <[email protected]>
Co-authored-by: Eryk Sun <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
  • Loading branch information
3 people authored and miss-islington committed Nov 14, 2022
commit cd26cf481f2a1d38ddfabd5a6934035089d64fbe
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()`.