Skip to content

Commit 2ab7100

Browse files
authored
shutil: add chown args in py313 (#11973)
1 parent 68e1396 commit 2ab7100

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

stdlib/shutil.pyi

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,44 @@ def disk_usage(path: FileDescriptorOrPath) -> _ntuple_diskusage: ...
132132
# While chown can be imported on Windows, it doesn't actually work;
133133
# see https://bugs.python.org/issue33140. We keep it here because it's
134134
# in __all__.
135-
@overload
136-
def chown(path: FileDescriptorOrPath, user: str | int, group: None = None) -> None: ...
137-
@overload
138-
def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int) -> None: ...
139-
@overload
140-
def chown(path: FileDescriptorOrPath, user: None, group: str | int) -> None: ...
141-
@overload
142-
def chown(path: FileDescriptorOrPath, user: str | int, group: str | int) -> None: ...
135+
if sys.version_info >= (3, 13):
136+
@overload
137+
def chown(
138+
path: FileDescriptorOrPath,
139+
user: str | int,
140+
group: None = None,
141+
*,
142+
dir_fd: int | None = None,
143+
follow_symlinks: bool = True,
144+
) -> None: ...
145+
@overload
146+
def chown(
147+
path: FileDescriptorOrPath,
148+
user: None = None,
149+
*,
150+
group: str | int,
151+
dir_fd: int | None = None,
152+
follow_symlinks: bool = True,
153+
) -> None: ...
154+
@overload
155+
def chown(
156+
path: FileDescriptorOrPath, user: None, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True
157+
) -> None: ...
158+
@overload
159+
def chown(
160+
path: FileDescriptorOrPath, user: str | int, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True
161+
) -> None: ...
162+
163+
else:
164+
@overload
165+
def chown(path: FileDescriptorOrPath, user: str | int, group: None = None) -> None: ...
166+
@overload
167+
def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int) -> None: ...
168+
@overload
169+
def chown(path: FileDescriptorOrPath, user: None, group: str | int) -> None: ...
170+
@overload
171+
def chown(path: FileDescriptorOrPath, user: str | int, group: str | int) -> None: ...
172+
143173
@overload
144174
def which(cmd: _StrPathT, mode: int = 1, path: StrPath | None = None) -> str | _StrPathT | None: ...
145175
@overload

0 commit comments

Comments
 (0)