Skip to content

Commit 2d33fe2

Browse files
jzazoJelleZijlstraAlexWaygood
authored
deprecate pathlib.Path.link_to (#11875)
Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
1 parent 3e3fd0d commit 2d33fe2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

stdlib/pathlib.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWra
1515
from os import PathLike, stat_result
1616
from types import TracebackType
1717
from typing import IO, Any, BinaryIO, Literal, overload
18-
from typing_extensions import Self
18+
from typing_extensions import Self, deprecated
1919

2020
if sys.version_info >= (3, 9):
2121
from types import GenericAlias
@@ -222,7 +222,11 @@ class Path(PurePath):
222222
else:
223223
def write_text(self, data: str, encoding: str | None = None, errors: str | None = None) -> int: ...
224224
if sys.version_info < (3, 12):
225-
def link_to(self, target: StrOrBytesPath) -> None: ...
225+
if sys.version_info >= (3, 10):
226+
@deprecated("Deprecated as of Python 3.10 and removed in Python 3.12. Use hardlink_to() instead.")
227+
def link_to(self, target: StrOrBytesPath) -> None: ...
228+
else:
229+
def link_to(self, target: StrOrBytesPath) -> None: ...
226230
if sys.version_info >= (3, 12):
227231
def walk(
228232
self, top_down: bool = ..., on_error: Callable[[OSError], object] | None = ..., follow_symlinks: bool = ...

0 commit comments

Comments
 (0)