Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-39950: add pathlib.Path.hardlink_to() method that supersedes link_to() #18909

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Mar 11, 2020

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().

https://bugs.python.org/issue39950

Automerge-Triggered-By: GH:brettcannon

@tirkarthi
Copy link
Member

tirkarthi commented Mar 11, 2020

The issue was closed as a duplicate so I would prefer closing the PR. Thanks.

@barneygale barneygale changed the title bpo-39925: add pathlib.Path.hardlink_to() method that supersedes link_to() bpo-39950: add pathlib.Path.hardlink_to() method that supersedes link_to() Mar 13, 2020
@barneygale
Copy link
Contributor Author

barneygale commented Mar 13, 2020

I've logged a new bug after some discussion on the python-dev mailing list: https://bugs.python.org/issue39950

Copy link
Member

@brettcannon brettcannon left a comment

Some doc restructuring and also making sure the public API doesn't break due to this.

Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Doc/library/pathlib.rst Show resolved Hide resolved
Lib/pathlib.py Outdated Show resolved Hide resolved
Lib/pathlib.py Outdated Show resolved Hide resolved
Lib/pathlib.py Outdated Show resolved Hide resolved
Lib/pathlib.py Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

bedevere-bot commented Mar 13, 2020

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@brettcannon brettcannon requested a review from pitrou Mar 13, 2020
@barneygale barneygale force-pushed the bpo-39925-pathlib-path-hard-link-arg-order branch from 248c6e8 to 430b7f7 Compare Mar 21, 2020
Copy link
Member

@pitrou pitrou left a comment

This looks mostly good. Just two comments.

Also, can you rebase/merge from master?

Lib/test/test_pathlib.py Outdated Show resolved Hide resolved
Lib/pathlib.py Outdated Show resolved Hide resolved
@barneygale barneygale force-pushed the bpo-39925-pathlib-path-hard-link-arg-order branch from b32aaa6 to b7c8ab2 Compare May 29, 2020
@barneygale barneygale force-pushed the bpo-39925-pathlib-path-hard-link-arg-order branch 2 times, most recently from ec1bea4 to a65799e Compare Jan 22, 2021
@barneygale barneygale changed the title bpo-39950: add pathlib.Path.hardlink_to() method that supersedes link_to() WIP: bpo-39950: add pathlib.Path.hardlink_to() method that supersedes link_to() Jan 22, 2021
@barneygale
Copy link
Contributor Author

barneygale commented Jan 22, 2021

Marking as WIP as I'll address bpo-42999 first.

@barneygale barneygale force-pushed the bpo-39925-pathlib-path-hard-link-arg-order branch 2 times, most recently from de0b686 to 2dfa391 Compare Apr 7, 2021
@barneygale barneygale changed the title WIP: bpo-39950: add pathlib.Path.hardlink_to() method that supersedes link_to() bpo-39950: add pathlib.Path.hardlink_to() method that supersedes link_to() Apr 7, 2021
@barneygale
Copy link
Contributor Author

barneygale commented Apr 7, 2021

Removed 'WIP' from the title. This is ready to review again! Thanks all.

@brettcannon
Copy link
Member

brettcannon commented Apr 7, 2021

@barneygale please see #18909 (comment) on how to ask for a new round of reviews.

@barneygale
Copy link
Contributor Author

barneygale commented Apr 7, 2021

I have made the requested changes; please review again

@bedevere-bot
Copy link

bedevere-bot commented Apr 7, 2021

Thanks for making the requested changes!

@brettcannon: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from brettcannon Apr 7, 2021
@brettcannon
Copy link
Member

brettcannon commented Apr 9, 2021

LGTM!

@barneygale are you up for writing the "What's New" entry to document the addition of the hardlink_to() and the deprecation of link_to()? It's okay if you're not, but it simplifies things for the release if it's updated now.

@barneygale
Copy link
Contributor Author

barneygale commented Apr 9, 2021

LGTM!

@barneygale are you up for writing the "What's New" entry to document the addition of the hardlink_to() and the deprecation of link_to()? It's okay if you're not, but it simplifies things for the release if it's updated now.

I've added a new commit - hope it looks alright?

barneygale added 2 commits Apr 13, 2021
…ink_to()`

The argument order of `link_to()` is reversed, 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*. This doesn't match `symlink_to()` nor the documentation
and doesn't seem to be the original author's intent.

This commit deprecates `link_to()` and introduces `hardlink_to()`, which
has the same argument order as `symlink_to()`.
@barneygale barneygale force-pushed the bpo-39925-pathlib-path-hard-link-arg-order branch from 94c5acb to e506cae Compare Apr 13, 2021
@barneygale barneygale requested a review from pitrou Apr 13, 2021
@barneygale
Copy link
Contributor Author

barneygale commented Apr 19, 2021

@brettcannon sorry to bother, just bumping this review as I saw there's a feature freeze in two weeks! Thanks.

@brettcannon
Copy link
Member

brettcannon commented Apr 21, 2021

@barneygale yep, this is the top of my review queue and I'm hoping to get to it this Friday (steering council stuff has to take priority, unfortunately).

@brettcannon brettcannon added the 🤖 automerge PR will be merged once it's been approved and all CI passed label Apr 23, 2021
@miss-islington miss-islington merged commit f24e2e5 into python:master Apr 23, 2021
11 checks passed
@brettcannon
Copy link
Member

brettcannon commented Apr 23, 2021

@barneygale Thanks!

@barneygale
Copy link
Contributor Author

barneygale commented Apr 24, 2021

Thanks so much for the review! :-)

kreathon pushed a commit to kreathon/cpython that referenced this pull request May 2, 2021
…ink_to()` (pythonGH-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()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 automerge PR will be merged once it's been approved and all CI passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants