Skip to content

Commit 2fb9c35

Browse files
Put shutil.chown back on Windows (#7446)
See #7384 and #7443 (comment) (thanks @AlexWaygood for diagnosing).
1 parent addce5c commit 2fb9c35

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

stdlib/shutil.pyi

+11-11
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ class _ntuple_diskusage(NamedTuple):
101101

102102
def disk_usage(path: int | StrOrBytesPath) -> _ntuple_diskusage: ...
103103

104-
if sys.platform != "win32":
105-
# while chown can be imported on Windows it doesn't actually work
106-
# see https://bugs.python.org/issue33140
107-
@overload
108-
def chown(path: StrOrBytesPath, user: str | int, group: None = ...) -> None: ...
109-
@overload
110-
def chown(path: StrOrBytesPath, user: None = ..., *, group: str | int) -> None: ...
111-
@overload
112-
def chown(path: StrOrBytesPath, user: None, group: str | int) -> None: ...
113-
@overload
114-
def chown(path: StrOrBytesPath, user: str | int, group: str | int) -> None: ...
104+
# While chown can be imported on Windows, it doesn't actually work;
105+
# see https://bugs.python.org/issue33140. We keep it here because it's
106+
# in __all__.
107+
@overload
108+
def chown(path: StrOrBytesPath, user: str | int, group: None = ...) -> None: ...
109+
@overload
110+
def chown(path: StrOrBytesPath, user: None = ..., *, group: str | int) -> None: ...
111+
@overload
112+
def chown(path: StrOrBytesPath, user: None, group: str | int) -> None: ...
113+
@overload
114+
def chown(path: StrOrBytesPath, user: str | int, group: str | int) -> None: ...
115115

116116
if sys.version_info >= (3, 8):
117117
@overload

tests/stubtest_allowlists/win32.txt

-3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,3 @@ ssl.SSLSocket.recvmsg
7575
ssl.SSLSocket.recvmsg_into
7676
ssl.SSLSocket.sendmsg
7777
winreg.HKEYType.handle
78-
79-
# exist but do not work on Windows
80-
shutil.chown

0 commit comments

Comments
 (0)