[pathlib] Deprecate additional arguments (#15228)

This commit is contained in:
Semyon Moroz
2026-01-07 17:14:49 +00:00
committed by GitHub
parent a68aa254d9
commit 3bf7f35646
+8
View File
@@ -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: ...