From c82ad374253cdc256e92d3debc8105be00114f7a Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Thu, 7 Aug 2025 11:51:17 +0000 Subject: [PATCH] [pathlib] Add `owner`, `group` methods on Windows (#14536) --- stdlib/@tests/stubtest_allowlists/win32-py314.txt | 2 -- stdlib/pathlib/__init__.pyi | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/win32-py314.txt b/stdlib/@tests/stubtest_allowlists/win32-py314.txt index 60dba9f2d..83e72a2d7 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 774478bb2..bf263f8b4 100644 --- a/stdlib/pathlib/__init__.pyi +++ b/stdlib/pathlib/__init__.pyi @@ -245,9 +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 on <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, 13): + 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] + else: def owner(self: Never) -> str: ... # type: ignore[misc] def group(self: Never) -> str: ... # type: ignore[misc] else: