gh-84131: Remove the deprecated pathlib.Path.link_to method. (#92505)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
This commit is contained in:
Gregory P. Smith 2022-05-10 12:31:41 -07:00 committed by GitHub
parent dde8a1668e
commit 07b34926d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 59 deletions

View file

@ -1199,23 +1199,6 @@ class Path(PurePath):
raise NotImplementedError("os.link() not available on this system")
os.link(target, self)
def link_to(self, target):
"""
Make the target path a hard link pointing to this path.
Note this function does not make this path a hard link to *target*,
despite the implication of the function and argument names. The order
of arguments (target, link) is the reverse of Path.symlink_to, but
matches that of os.link.
Deprecated since Python 3.10 and scheduled for removal in Python 3.12.
Use `hardlink_to()` instead.
"""
warnings.warn("pathlib.Path.link_to() is deprecated and is scheduled "
"for removal in Python 3.12. "
"Use pathlib.Path.hardlink_to() instead.",
DeprecationWarning, stacklevel=2)
self.__class__(target).hardlink_to(self)
# Convenience functions for querying the stat results