GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `pathlib.Path.owner()` and `.group()` should accept a `follow_symlinks` argument · Issue #103363 · python/cpython

pathlib.Path.owner() and .group() should accept a follow_symlinks argument #103363

New issue
Copy link
New issue
Copy link
Closed
Closed
pathlib.Path.owner() and .group() should accept a follow_symlinks argument#103363
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-pathlibtype-featureA feature request or enhancementA feature request or enhancement

Description

@markrwilliams
markrwilliams
opened on Apr 8, 2023
Issue body actions

Feature or enhancement

pathlib.Path.owner() and pathlib.Path.group() always follow symbolic links. They should gain a new argument, follow_symlinks, that defaults to True. This will align their API with that of pathlib.Path.stat() and pathlib.Path.chmod()

Pitch

Most pathlib.Path methods follow symbolic links, so it's natural for these ownership methods to do the same.
However, doing so unconditionally results in a surprising error when you'd actually like them to look at a link's ownership - for example, to work with a system that uses dangling symbolic links as lock files - and there's no convenient API to call instead.

Previous discussion

#65521 brought up the same issue but proposed fixing it by changing the system call from stat to lstat, which was deemed too disruptive.
#18864 added follow_symlinks to pathlib.Path.stat and pathlib.Path.chmod. A commenter asked about adding this argument to other methods, namely is_file() and is_dir().

I'm happy to contribute the code if this seems worth doing.

Linked PRs

  • gh-103363: Add follow_symlinks argument to pathlib.Path.owner() and group() #107962
Reacted by Barney Gale

Activity

  1. markrwilliams
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Apr 8, 2023
  2. sobolevn
    added
    topic-pathlib
    on Apr 8, 2023
  3. barneygale commented on Apr 9, 2023

    @barneygale
    barneygale
    on Apr 9, 2023
    Contributor
    More actions

    Sounds reasonable to me!

  4. ganesh-k13 commented on May 14, 2023

    @ganesh-k13
    ganesh-k13
    on May 14, 2023
    Contributor
    More actions

    @markrwilliams are you working on this issue? I'd be happy to add it if you are not.

  5. kamilturek commented on Aug 15, 2023

    @kamilturek
    kamilturek
    on Aug 15, 2023
    Contributor
    More actions

    Given no action for several months on this issue, I decided to open a PR.

  6. iritkatriel
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Nov 23, 2023
  7. kamilturek
    added a commit that references this issue on Dec 2, 2023

    Merge branch 'main' into pythongh-103363

    5ed359d
  8. barneygale
    added this to pathlib issueson Dec 2, 2023
  9. barneygale
    added a commit that references this issue on Dec 4, 2023

    gh-103363: Add follow_symlinks argument to `pathlib.Path.owner()` and…

    a1551b4
  10. barneygale commented on Dec 4, 2023

    @barneygale
    barneygale
    on Dec 4, 2023
    Contributor
    More actions

    Implemented by @kamilturek in #107962, merged into 3.13 as a1551b4 🎉

  11. barneygale
    closed this as completedon Dec 4, 2023
  12. github-project-automation
    moved this to Done in pathlib issueson Dec 4, 2023
  13. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-103363: Add follow_symlinks argument to `pathlib.Path.owner(…

    0909269
  14. jb2170 commented on Jul 8, 2024

    @jb2170
    jb2170
    on Jul 8, 2024
    Contributor
    More actions

    Nice

  15. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-103363: Add follow_symlinks argument to `pathlib.Path.owner(…

    b0c814f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-pathlibtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    • pathlib issues
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.