Skip to content

bpo-26978: Implement pathlib.Path.link_to (Using os.link)#12990

Merged
pitrou merged 7 commits into
python:masterfrom
nanjekyejoannah:issue26978
May 4, 2019
Merged

bpo-26978: Implement pathlib.Path.link_to (Using os.link)#12990
pitrou merged 7 commits into
python:masterfrom
nanjekyejoannah:issue26978

Conversation

@nanjekyejoannah

@nanjekyejoannah nanjekyejoannah commented Apr 28, 2019

Copy link
Copy Markdown
Contributor

I have implemented pathlib.Path.link_to.

https://bugs.python.org/issue26978

@nanjekyejoannah

Copy link
Copy Markdown
Contributor Author

cc @pitrou

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Doc/library/pathlib.rst Outdated
Comment thread Doc/library/pathlib.rst
Comment thread Lib/pathlib.py Outdated
Comment thread Lib/test/test_pathlib.py
@bedevere-bot

Copy link
Copy Markdown

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.

And if you don't make the requested changes, you will be poked with soft cushions!

@nanjekyejoannah

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

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

Comment thread Doc/whatsnew/3.8.rst Outdated
@pitrou pitrou changed the title bpo-26978: Implement pathlib.Path.link (Using os.link) bpo-26978: Implement pathlib.Path.link_to (Using os.link) May 4, 2019
@pitrou

pitrou commented May 4, 2019

Copy link
Copy Markdown
Member

Thank you @nanjekyejoannah. I will wait for CI to pass and then merge if green.

Comment thread Doc/whatsnew/3.8.rst

Added :meth:`pathlib.Path.link_to()` which creates a hard link pointing
to a path.
(Contributed by Joannah Nanjekye in :issue:`26978`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(Contributed by Joannah Nanjekye in :issue:`26978`)
(Contributed by Joannah Nanjekye in :issue:`26978`.)

@pitrou
pitrou merged commit 6b5b013 into python:master May 4, 2019
@nanjekyejoannah
nanjekyejoannah deleted the issue26978 branch May 4, 2019 15:30
@@ -0,0 +1,2 @@
`pathlib.path.link_to()` is now implemented. It creates a hard link pointing

Copy link
Copy Markdown
Contributor

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

tohojo added a commit to tohojo/cpython that referenced this pull request Nov 16, 2019
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 <toke@redhat.com>
tohojo added a commit to tohojo/cpython that referenced this pull request Nov 18, 2019
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 <toke@redhat.com>
vstinner pushed a commit that referenced this pull request Dec 16, 2019
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 <toke@redhat.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 16, 2019
…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 <toke@redhat.com>
(cherry picked from commit 092435e)

Co-authored-by: Toke Høiland-Jørgensen <toke@redhat.com>
miss-islington added a commit that referenced this pull request Dec 16, 2019
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 <toke@redhat.com>
(cherry picked from commit 092435e)

Co-authored-by: Toke Høiland-Jørgensen <toke@redhat.com>
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
…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 <toke@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants