8000 bpo-24132: Add direct subclassing of PurePath/Path in pathlib by kfollstad · Pull Request #26906 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-24132: Add direct subclassing of PurePath/Path in pathlib #26906

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

Closed
wants to merge 7 commits into from
Prev Previous commit
Next Next commit
bpo-24132: Fix inconsistent organization of is_mount in pathlib
Existing is_mount method in Path was Posix only and not cross-
platform even though it was in a cross-platform base class. The existing
design relied upon being overriden later in WindowsPath. Consolidated
code from both into new Path.is_mount() which is now cross-plaform
similiar to all of the other Path methods.
  • Loading branch information
kfollstad committed Jun 24, 2021
commit 35d8f789fad64674a7c7d254f2d5808049f0e504
6 changes: 3 additions & 3 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,9 @@ def is_mount(self):
"""
Check if this path is a POSIX mount point
"""
if os.name != "posix":
raise NotImplementedError("Path.is_mount() is "
"unsupported on this system")
# Need to exist and be a dir
if not self.exists() or not self.is_dir():
return False
Expand Down Expand Up @@ -1444,6 +1447,3 @@ class WindowsPath(Path, PureWindowsPath):
On a Windows system, instantiating a Path should return this object.
"""
__slots__ = ()

def is_mount(self):
raise NotImplementedError("Path.is_mount() is unsupported on this system")
0