From 2b5ddaa72bc1300b76f61cfd1236b358a98bb069 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sun, 6 Mar 2022 16:15:27 -0800 Subject: [PATCH 1/2] Put shutil.chown back on Windows See #7384 and https://github.com/python/typeshed/pull/7443#issuecomment-1060071944 (thanks @AlexWaygood for diagnosing). --- stdlib/shutil.pyi | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index 55c964fbdcf9..030f16cd99b7 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -101,17 +101,17 @@ class _ntuple_diskusage(NamedTuple): def disk_usage(path: int | StrOrBytesPath) -> _ntuple_diskusage: ... -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: ... +# While chown can be imported on Windows, it doesn't actually work; +# see https://bugs.python.org/issue33140. We keep it here because it's +# in __all__. +@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 From 4261d432eb8036367c1cdce75869154eb1faf274 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sun, 6 Mar 2022 16:18:58 -0800 Subject: [PATCH 2/2] unallowlist --- tests/stubtest_allowlists/win32.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/stubtest_allowlists/win32.txt b/tests/stubtest_allowlists/win32.txt index f7d68a3a0fd2..ec7c2a84c94d 100644 --- a/tests/stubtest_allowlists/win32.txt +++ b/tests/stubtest_allowlists/win32.txt @@ -75,6 +75,3 @@ ssl.SSLSocket.recvmsg ssl.SSLSocket.recvmsg_into ssl.SSLSocket.sendmsg winreg.HKEYType.handle - -# exist but do not work on Windows -shutil.chown