Content-Length: 307421 | pFad | https://github.com/python/cpython/commit/367f552129341796d75fc4cc40edb49405235a2b

70 gh-96192: fix os.ismount() to use a path that is str or bytes (#96194) · python/cpython@367f552 · GitHub
Skip to content

Commit 367f552

Browse files
calestyoeryksunJelleZijlstra
authored
gh-96192: fix os.ismount() to use a path that is str or bytes (#96194)
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 1455c51 commit 367f552

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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python/cpython/commit/367f552129341796d75fc4cc40edb49405235a2b

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy