From 44cb1cf9c1362055f9f45f20edf749ba74e79596 Mon Sep 17 00:00:00 2001 From: donbarbos Date: Wed, 7 Jan 2026 20:52:44 +0400 Subject: [PATCH] [pathlib] Deprecate additional arguments Docs: https://docs.python.org/dev/library/pathlib.html#pathlib.PurePath.is_relative_to Source: https://github.com/python/cpython/blob/43e495d6f4e0efe6e7a54625d559f2f656f36916/Lib/pathlib/_local.py#L365C38-L365C49 --- stdlib/pathlib/__init__.pyi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stdlib/pathlib/__init__.pyi b/stdlib/pathlib/__init__.pyi index 33652d922568..26dde2accd8d 100644 --- a/stdlib/pathlib/__init__.pyi +++ b/stdlib/pathlib/__init__.pyi @@ -104,6 +104,10 @@ class PurePath(PathLike[str]): if sys.version_info >= (3, 14): def is_relative_to(self, other: StrPath) -> bool: ... elif sys.version_info >= (3, 12): + @overload + def is_relative_to(self, other: StrPath, /) -> bool: ... + @overload + @deprecated("Passing additional arguments is deprecated since Python 3.12; removed in Python 3.14.") def is_relative_to(self, other: StrPath, /, *_deprecated: StrPath) -> bool: ... else: def is_relative_to(self, *other: StrPath) -> bool: ... @@ -116,6 +120,10 @@ class PurePath(PathLike[str]): if sys.version_info >= (3, 14): def relative_to(self, other: StrPath, *, walk_up: bool = False) -> Self: ... elif sys.version_info >= (3, 12): + @overload + def relative_to(self, other: StrPath, /, *, walk_up: bool = False) -> Self: ... + @overload + @deprecated("Passing additional arguments is deprecated since Python 3.12; removed in Python 3.14.") def relative_to(self, other: StrPath, /, *_deprecated: StrPath, walk_up: bool = False) -> Self: ... else: def relative_to(self, *other: StrPath) -> Self: ...