From e9b3b03764d0557e103e1b2c4d95ce02965db22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oleg=20H=C3=B6fling?= Date: Wed, 7 Aug 2024 15:43:13 +0200 Subject: [PATCH] refactor(pathlib): allow PathLike[str] arg type in Path.replace and Path.rename methods (#12494) --- stdlib/pathlib.pyi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index fd05c937d..641f9a8a0 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -232,8 +232,13 @@ class Path(PurePath): if sys.version_info >= (3, 9): def readlink(self) -> Self: ... - def rename(self, target: str | PurePath) -> Self: ... - def replace(self, target: str | PurePath) -> Self: ... + if sys.version_info >= (3, 10): + def rename(self, target: StrPath) -> Self: ... + def replace(self, target: StrPath) -> Self: ... + else: + def rename(self, target: str | PurePath) -> Self: ... + def replace(self, target: str | PurePath) -> Self: ... + def resolve(self, strict: bool = False) -> Self: ... def rmdir(self) -> None: ... def symlink_to(self, target: StrOrBytesPath, target_is_directory: bool = False) -> None: ...