Skip to content

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Sep 24, 2025

Add stat() method to pathlib.Path.info that returns a (possibly cached) os.stat_result object. We don't add it to pathlib.types.PathInfo because it's too specific to local filesystem paths. This requires a bit of reworking of the docs to explain!

Rename pathlib._Info to pathlib.Info and document it, including the new stat() method. Ensure it can't be instantiated by users. Move the existing docs for pathlib.types to a new page.


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

Add `stat()` method to `pathlib.Path.info` that returns a (possibly cached)
`os.stat_result` object. We don't add it to `pathlib.types.PathInfo`
because it's too specific to local filesystem paths. This requires a bit of
reworking of the docs to explain!

Rename `pathlib._Info` to `pathlib.Info` and document it, including the new
`stat()` method. Ensure it can't be instantiated by users. Move the
existing docs for `pathlib.types` to a new page.
@barneygale barneygale marked this pull request as ready for review September 24, 2025 03:03
@barneygale barneygale requested a review from encukou September 24, 2025 03:03
Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

I appreciate that stat() isn't the best API, but it is useful for interop with existing systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants