@@ -16,7 +16,7 @@ from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWra
1616from os import PathLike , stat_result
1717from types import TracebackType
1818from typing import IO , Any , BinaryIO , ClassVar , Literal , overload
19- from typing_extensions import Self , deprecated
19+ from typing_extensions import Never , Self , deprecated
2020
2121if sys .version_info >= (3 , 9 ):
2222 from types import GenericAlias
@@ -226,9 +226,13 @@ class Path(PurePath):
226226 def open (
227227 self , mode : str , buffering : int = - 1 , encoding : str | None = None , errors : str | None = None , newline : str | None = None
228228 ) -> IO [Any ]: ...
229- if sys .platform != "win32" :
230- # These methods do "exist" on Windows, but they always raise NotImplementedError,
231- # so it's safer to pretend they don't exist
229+
230+ # These methods do "exist" on Windows on <3.13, but they always raise NotImplementedError.
231+ if sys .platform == "win32" :
232+ if sys .version_info < (3 , 13 ):
233+ def owner (self : Never ) -> str : ... # type: ignore[misc]
234+ def group (self : Never ) -> str : ... # type: ignore[misc]
235+ else :
232236 if sys .version_info >= (3 , 13 ):
233237 def owner (self , * , follow_symlinks : bool = True ) -> str : ...
234238 def group (self , * , follow_symlinks : bool = True ) -> str : ...
@@ -238,7 +242,9 @@ class Path(PurePath):
238242
239243 # This method does "exist" on Windows on <3.12, but always raises NotImplementedError
240244 # On py312+, it works properly on Windows, as with all other platforms
241- if sys .platform != "win32" or sys .version_info >= (3 , 12 ):
245+ if sys .platform == "win32" and sys .version_info < (3 , 12 ):
246+ def is_mount (self : Never ) -> bool : ... # type: ignore[misc]
247+ else :
242248 def is_mount (self ) -> bool : ...
243249
244250 if sys .version_info >= (3 , 9 ):
0 commit comments