diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index 752cf2cb5..55c964fbd 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -100,14 +100,18 @@ class _ntuple_diskusage(NamedTuple): free: int def disk_usage(path: int | StrOrBytesPath) -> _ntuple_diskusage: ... -@overload -def chown(path: StrOrBytesPath, user: str | int, group: None = ...) -> None: ... -@overload -def chown(path: StrOrBytesPath, user: None = ..., *, group: str | int) -> None: ... -@overload -def chown(path: StrOrBytesPath, user: None, group: str | int) -> None: ... -@overload -def chown(path: StrOrBytesPath, user: str | int, group: str | int) -> None: ... + +if sys.platform != "win32": + # while chown can be imported on Windows it doesn't actually work + # see https://bugs.python.org/issue33140 + @overload + def chown(path: StrOrBytesPath, user: str | int, group: None = ...) -> None: ... + @overload + def chown(path: StrOrBytesPath, user: None = ..., *, group: str | int) -> None: ... + @overload + def chown(path: StrOrBytesPath, user: None, group: str | int) -> None: ... + @overload + def chown(path: StrOrBytesPath, user: str | int, group: str | int) -> None: ... if sys.version_info >= (3, 8): @overload diff --git a/tests/stubtest_allowlists/win32.txt b/tests/stubtest_allowlists/win32.txt index ec7c2a84c..f7d68a3a0 100644 --- a/tests/stubtest_allowlists/win32.txt +++ b/tests/stubtest_allowlists/win32.txt @@ -75,3 +75,6 @@ ssl.SSLSocket.recvmsg ssl.SSLSocket.recvmsg_into ssl.SSLSocket.sendmsg winreg.HKEYType.handle + +# exist but do not work on Windows +shutil.chown