Skip to content

GH-139174: Add pathlib.Path.info.mode()#139183

Draft
barneygale wants to merge 2 commits into
python:mainfrom
barneygale:gh-139174-mode
Draft

GH-139174: Add pathlib.Path.info.mode()#139183
barneygale wants to merge 2 commits into
python:mainfrom
barneygale:gh-139174-mode

Conversation

@barneygale

@barneygale barneygale commented Sep 20, 2025

Copy link
Copy Markdown
Contributor

Add mode() method to the PathInfo protocol. A concrete implementation is available via Path.info.mode(). This method caches and returns the Posix file permissions, i.e. st_mode from the stat struct with its file format bits masked out.

In the tests for the pathlib ABCs, add mode() methods to our ZipPathInfo and LocalPathInfo classes, and test them from test_read.


📚 Documentation preview 📚: https://cpython-previews--139183.org.readthedocs.build/

Add `mode()` method to the `PathInfo` protocol. A concrete implementation
is available via `Path.info.mode()`. This method caches and returns the
Posix file permissions, i.e. `st_mode` from the stat struct with its file
format bits masked out.

In the tests for the pathlib ABCs, add `mode()` methods to our
`ZipPathInfo` and `LocalPathInfo` classes, and test them from `test_read`.
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PR or inactive for long period of time. topic-pathlib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants