Skip to content

Commit c3791d0

Browse files
authored
pathlib: is_mount() is implemented on Windows on py312+ (#10257)
1 parent 7df870f commit c3791d0

File tree

7 files changed

+9
-3
lines changed

7 files changed

+9
-3
lines changed

stdlib/pathlib.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ class Path(PurePath):
159159
# so it's safer to pretend they don't exist
160160
def owner(self) -> str: ...
161161
def group(self) -> str: ...
162+
163+
# This method does "exist" on Windows on <3.12, but always raises NotImplementedError
164+
# On py312+, it works properly on Windows, as with all other platforms
165+
if sys.platform != "win32" or sys.version_info >= (3, 12):
162166
def is_mount(self) -> bool: ...
163167

164168
if sys.version_info >= (3, 9):

tests/stubtest_allowlists/win32-py310.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ subprocess.STARTUPINFO.copy
1212

1313
# pathlib methods that exist on Windows, but always raise NotImplementedError,
1414
# so are omitted from the stub
15+
pathlib.Path.is_mount
1516
pathlib.WindowsPath.is_mount

tests/stubtest_allowlists/win32-py311.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ subprocess.STARTUPINFO.copy
1515

1616
# pathlib methods that exist on Windows, but always raise NotImplementedError,
1717
# so are omitted from the stub
18+
pathlib.Path.is_mount
1819
pathlib.WindowsPath.is_mount

tests/stubtest_allowlists/win32-py37.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ urllib.parse.parse_qsl
1414

1515
# pathlib methods that exist on Windows, but always raise NotImplementedError,
1616
# so are omitted from the stub
17+
pathlib.Path.is_mount
1718
pathlib.WindowsPath.group
1819
pathlib.WindowsPath.owner
1920
pathlib.WindowsPath.is_mount

tests/stubtest_allowlists/win32-py38.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ subprocess.STARTUPINFO.copy
1515

1616
# pathlib methods that exist on Windows, but always raise NotImplementedError,
1717
# so are omitted from the stub
18+
pathlib.Path.is_mount
1819
pathlib.WindowsPath.group
1920
pathlib.WindowsPath.owner
2021
pathlib.WindowsPath.is_mount

tests/stubtest_allowlists/win32-py39.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ subprocess.STARTUPINFO.copy
1111

1212
# pathlib methods that exist on Windows, but always raise NotImplementedError,
1313
# so are omitted from the stub
14+
pathlib.Path.is_mount
1415
pathlib.WindowsPath.is_mount

tests/stubtest_allowlists/win32.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,3 @@ tty
6666
# pathlib functions that rely on modules that don't exist on Windows
6767
pathlib.Path.owner
6868
pathlib.Path.group
69-
# pathlib methods that exist on Windows, but always raise NotImplementedError,
70-
# so are omitted from the stub
71-
pathlib.Path.is_mount

0 commit comments

Comments
 (0)