-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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-26978: Implement pathlib.Path.link_to (Using os.link) #12990
Conversation
cc @pitrou |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this PR. You'll find some comments below.
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 And if you don't make the requested changes, you will be poked with soft cushions! |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @pitrou: please review the changes made to this pull request. |
Thank you @nanjekyejoannah. I will wait for CI to pass and then merge if green. |
@@ -334,6 +334,10 @@ pathlib | |||
contain characters unrepresentable at the OS level. | |||
(Contributed by Serhiy Storchaka in :issue:`33721`.) | |||
|
|||
Added :meth:`pathlib.Path.link_to()` which creates a hard link pointing | |||
to a path. | |||
(Contributed by Joannah Nanjekye in :issue:`26978`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Contributed by Joannah Nanjekye in :issue:`26978`) | |
(Contributed by Joannah Nanjekye in :issue:`26978`.) |
@@ -0,0 +1,2 @@ | |||
`pathlib.path.link_to()` is now implemented. It creates a hard link pointing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be pathlib.Path.link_to()
, not pathlib.path.link_to()
.
Also, double backqoutes should be used here instead of single backquotes (as per https://devguide.python.org/documenting/#inline-markup). The following could also be used:
:meth:`pathlib.Path.link_to()`
Commit 6b5b013 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (pythonGH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Commit 6b5b013 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (pythonGH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Commit 6b5b013 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (GH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
…17225) Commit 6b5b013 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (pythonGH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke Høiland-Jørgensen <[email protected]> (cherry picked from commit 092435e) Co-authored-by: Toke Høiland-Jørgensen <[email protected]>
Commit 6b5b013 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (GH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke Høiland-Jørgensen <[email protected]> (cherry picked from commit 092435e) Co-authored-by: Toke Høiland-Jørgensen <[email protected]>
…17225) Commit 6b5b013 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (pythonGH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
I have implemented
pathlib.Path.link_to
.https://bugs.python.org/issue26978