]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-139174: Prepare `pathlib.Path.info` for new methods (#139175)
authorBarney Gale <barney.gale@gmail.com>
Wed, 24 Sep 2025 01:52:24 +0000 (02:52 +0100)
committerGitHub <noreply@github.com>
Wed, 24 Sep 2025 01:52:24 +0000 (01:52 +0000)
commit9e6493849ec2389460a8933314fcc8b7be01c221
tree126c28ea2c8095b571f2dee7fc6ddba875877fec
parent1a2e00c97acfe9f797228b836e2345f630d07b8e
GH-139174: Prepare `pathlib.Path.info` for new methods (#139175)

Merge `_WindowsPathInfo` and `_PosixPathInfo` classes into a new
`_StatResultInfo` class. On Windows, this means relying on `os.stat()`
rather than `os.path.isfile()` and friends, which is a little slower. But
there's value in making the code easier to maintain, and we're going to
need the stat result for implementing `size()`, `mode()` etc.

Also move the classes from `pathlib._os` to `pathlib` proper.
Lib/pathlib/__init__.py
Lib/pathlib/_os.py