]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-39950: add `pathlib.Path.hardlink_to()` method that supersedes `link_to()` (GH...
authorBarney Gale <barney.gale@gmail.com>
Fri, 23 Apr 2021 20:48:52 +0000 (21:48 +0100)
committerGitHub <noreply@github.com>
Fri, 23 Apr 2021 20:48:52 +0000 (13:48 -0700)
commitf24e2e5464ba6498e7b8d73c3f9b417d59fd1b26
treecef5b64a2c1c204cc45ec778be4689f0ed5d811d
parente047239eafefe8b19725efffe7756443495cf78b
bpo-39950: add `pathlib.Path.hardlink_to()` method that supersedes `link_to()` (GH-18909)

The argument order of `link_to()` is reversed compared to what one may expect, so:

    a.link_to(b)

Might be expected to create *a* as a link to *b*, in fact it creates *b* as a link to *a*, making it function more like a "link from". This doesn't match `symlink_to()` nor the documentation and doesn't seem to be the original author's intent.

This PR deprecates `link_to()` and introduces `hardlink_to()`, which has the same argument order as `symlink_to()`.
Doc/library/pathlib.rst
Doc/whatsnew/3.10.rst
Lib/pathlib.py
Lib/test/test_pathlib.py
Misc/NEWS.d/next/Library/2021-01-22-00-15-37.bpo-39950.NzLVaR.rst [new file with mode: 0644]