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

readlink for pathlib paths #74803

Closed
smheidrich mannequin opened this issue Jun 9, 2017 · 5 comments
Closed

readlink for pathlib paths #74803

smheidrich mannequin opened this issue Jun 9, 2017 · 5 comments
Assignees
Labels
3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@smheidrich
Copy link
Mannequin

smheidrich mannequin commented Jun 9, 2017

BPO 30618
Nosy @gpshead, @pitrou, @berkerpeksag, @timofurrer, @miss-islington, @girtsf
PRs
  • bpo-30618: add readlink to pathlib.Path #8285
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/gpshead'
    closed_at = <Date 2019-10-23.22:37:43.806>
    created_at = <Date 2017-06-09.23:55:59.670>
    labels = ['type-feature', 'library', '3.9']
    title = 'readlink for pathlib paths'
    updated_at = <Date 2019-10-23.22:37:43.804>
    user = 'https://bugs.python.org/smheidrich'

    bugs.python.org fields:

    activity = <Date 2019-10-23.22:37:43.804>
    actor = 'gregory.p.smith'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2019-10-23.22:37:43.806>
    closer = 'gregory.p.smith'
    components = ['Library (Lib)']
    creation = <Date 2017-06-09.23:55:59.670>
    creator = 'smheidrich'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30618
    keywords = ['patch']
    message_count = 5.0
    messages = ['295592', '320335', '324364', '355266', '355271']
    nosy_count = 9.0
    nosy_names = ['gregory.p.smith', 'pitrou', 'spatz', 'planet36', 'berker.peksag', 'tuxtimo', 'smheidrich', 'miss-islington', 'girts']
    pr_nums = ['8285']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue30618'
    versions = ['Python 3.9']

    @smheidrich
    Copy link
    Mannequin Author

    smheidrich mannequin commented Jun 9, 2017

    Is there any reason why there is no equivalent of os.readlink in pathlib.Path? Note that Path.resolve does *not* fit the bill, as it always produces an absolute path, whereas readlink just spits out the symlink target exactly the way it is stored, which may be relative to the symlink itself:

    >>> import pathlib, os
    >>> p = pathlib.Path("/lib64/libc.so.6")
    >>> p.resolve()
    PosixPath('/lib64/libc-2.24.so')
    >>> os.readlink(str(p))
    'libc-2.24.so'

    @smheidrich smheidrich mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jun 9, 2017
    @girtsf
    Copy link
    Mannequin

    girtsf mannequin commented Jun 23, 2018

    Just ran into the same thing. I would be interested in adding support for a "readlink" call if a pull request on this would be welcome.

    @berkerpeksag
    Copy link
    Member

    The resolve() method already solves symlinks, but I think this is a reasonable feature request. I've just reviewed PR 8285.

    @berkerpeksag berkerpeksag added 3.8 only security fixes and removed 3.7 (EOL) end of life labels Aug 30, 2018
    @girtsf girtsf mannequin added 3.9 only security fixes and removed 3.8 only security fixes labels Jul 20, 2019
    @gpshead gpshead self-assigned this Oct 23, 2019
    @miss-islington
    Copy link
    Contributor

    New changeset a01ba33 by Miss Skeleton (bot) (Girts) in branch 'master':
    bpo-30618: add readlink to pathlib.Path (GH-8285)
    a01ba33

    @gpshead
    Copy link
    Member

    gpshead commented Oct 23, 2019

    Thanks Girts!

    @gpshead gpshead closed this as completed Oct 23, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants