classification
Title: pathlib handles missing `os.link`, `os.symlink` and `os.readlink` inconsistently
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Manjusaka, barneygale, steve.dower
Priority: normal Keywords: patch

Created on 2020-03-10 21:12 by barneygale, last changed 2021-05-15 22:25 by barneygale. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18998 open Manjusaka, 2020-03-14 17:31
PR 19220 merged barneygale, 2020-03-29 23:15
Messages (6)
msg363845 - (view) Author: Barney Gale (barneygale) * Date: 2020-03-10 21:12
Small bug report encompassing some related issues in `pathlib._NormalAccessor`:

- `link_to()` should be named `link()` for consistency with other methods
- `symlink()` doesn't need to guard against `os.symlink()` not accepting `target_is_directory` on non-Windows platforms; this has been fixed since 3.3
- `readlink()` doesn't raise `NotImplementedError` when `os.readlink()` is unavailable

Only the last of these has a user impact, and only on exotic systems.
msg364039 - (view) Author: Manjusaka (Manjusaka) * Date: 2020-03-12 18:39
I don't think rename 'link_to'  to 'link' directly is a good idea. Because there are many third-party libs have used this name. Unless we can keep two names in this version, and remind people the 'link_to' function will be deprecated totally in a future version. But is there any way to make a function as deprecated?

About 'os.readlink', we can hide this function in the platform that doesn't support readlink() just like `epoll' in mac or etc.
msg364040 - (view) Author: Manjusaka (Manjusaka) * Date: 2020-03-12 18:42
But when will os.readlink() be unavailable?
msg364041 - (view) Author: Manjusaka (Manjusaka) * Date: 2020-03-12 18:42
Fine, I get your means
msg364056 - (view) Author: Barney Gale (barneygale) * Date: 2020-03-12 23:34
Good points! Do you know of an example of a community library that uses `_Accessor.link`? Thanks
msg390385 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-04-06 23:01
New changeset b57e045320d1d2a70eab236b7d31a3ebb75037c3 by Barney Gale in branch 'master':
bpo-39924: handle missing os functions more consistently in pathlib (GH-19220)
https://github.com/python/cpython/commit/b57e045320d1d2a70eab236b7d31a3ebb75037c3
History
Date User Action Args
2021-05-15 22:25:48barneygalesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-04-06 23:01:37steve.dowersetnosy: + steve.dower
messages: + msg390385
2020-03-29 23:15:52barneygalesetpull_requests: + pull_request18582
2020-03-14 17:31:51Manjusakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request18345
2020-03-12 23:34:40barneygalesetmessages: + msg364056
2020-03-12 18:42:49Manjusakasetmessages: + msg364041
2020-03-12 18:42:08Manjusakasetmessages: + msg364040
2020-03-12 18:39:37Manjusakasetnosy: + Manjusaka
messages: + msg364039
2020-03-10 21:12:47barneygalecreate