mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
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:
parent
dde8a1668e
commit
07b34926d3
5 changed files with 7 additions and 59 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue