From db25c6fc9135a8b83d5b7e598c3ad2e88329ac5d Mon Sep 17 00:00:00 2001 From: donBarbos Date: Wed, 6 Aug 2025 10:28:44 +0400 Subject: [PATCH 1/2] [pathlib] Add `group`, `owner` methods on Windows --- stdlib/@tests/stubtest_allowlists/win32-py314.txt | 2 -- stdlib/pathlib/__init__.pyi | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/win32-py314.txt b/stdlib/@tests/stubtest_allowlists/win32-py314.txt index 60dba9f2de8e..83e72a2d7aa3 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py314.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py314.txt @@ -3,8 +3,6 @@ # ==================================================================== compression.zlib.ZLIBNG_VERSION -pathlib.Path.group -pathlib.Path.owner zlib.ZLIBNG_VERSION diff --git a/stdlib/pathlib/__init__.pyi b/stdlib/pathlib/__init__.pyi index 774478bb2ff4..68a8f2c6a727 100644 --- a/stdlib/pathlib/__init__.pyi +++ b/stdlib/pathlib/__init__.pyi @@ -245,8 +245,12 @@ class Path(PurePath): self, mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None ) -> IO[Any]: ... - # These methods do "exist" on Windows on <3.13, but they always raise NotImplementedError. + # These methods do "exist" on Windows exclude 3.13, but they always raise NotImplementedError. if sys.platform == "win32": + if sys.version_info >= (3, 14): + # raises UnsupportedOperation: + def owner(self: Never, *, follow_symlinks: bool = True) -> str: ... # type: ignore[misc] + def group(self: Never, *, follow_symlinks: bool = True) -> str: ... # type: ignore[misc] if sys.version_info < (3, 13): def owner(self: Never) -> str: ... # type: ignore[misc] def group(self: Never) -> str: ... # type: ignore[misc] From 008ac678fb7a29d5506203fe5cbc97e7510fb002 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Wed, 6 Aug 2025 16:11:49 +0400 Subject: [PATCH 2/2] Add methods on 3.13 --- stdlib/pathlib/__init__.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/pathlib/__init__.pyi b/stdlib/pathlib/__init__.pyi index 68a8f2c6a727..bf263f8b45a0 100644 --- a/stdlib/pathlib/__init__.pyi +++ b/stdlib/pathlib/__init__.pyi @@ -245,13 +245,13 @@ class Path(PurePath): self, mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None ) -> IO[Any]: ... - # These methods do "exist" on Windows exclude 3.13, but they always raise NotImplementedError. + # These methods do "exist" on Windows, but they always raise NotImplementedError. if sys.platform == "win32": - if sys.version_info >= (3, 14): + if sys.version_info >= (3, 13): # raises UnsupportedOperation: def owner(self: Never, *, follow_symlinks: bool = True) -> str: ... # type: ignore[misc] def group(self: Never, *, follow_symlinks: bool = True) -> str: ... # type: ignore[misc] - if sys.version_info < (3, 13): + else: def owner(self: Never) -> str: ... # type: ignore[misc] def group(self: Never) -> str: ... # type: ignore[misc] else: