Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
Labels
@markrwilliams

Description

@markrwilliams

Feature or enhancement

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

Pitch

Mostpathlib.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 fromstat tolstat, which was deemed too disruptive.
#18864 addedfollow_symlinks topathlib.Path.stat andpathlib.Path.chmod.A commenter asked about adding this argument to other methods, namelyis_file() andis_dir().

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

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp