From 3bf7f3564670782efe4191241fe9ba34fe98e236 Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Wed, 7 Jan 2026 17:14:49 +0000 Subject: [PATCH] [pathlib] Deprecate additional arguments (#15228) --- stdlib/pathlib/__init__.pyi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stdlib/pathlib/__init__.pyi b/stdlib/pathlib/__init__.pyi index 33652d922..26dde2acc 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: ...