aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_pathlib/test_pathlib_abc.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2025-02-17 19:15:25 +0000
committerGitHub <noreply@github.com>2025-02-17 19:15:25 +0000
commit7fcace99bbe1716c3e9713804e5bffaebdc8dd8f (patch)
tree0fb1a905454a744346aed55f6225cebfa18713ff /Lib/test/test_pathlib/test_pathlib_abc.py
parentbd1642c6e569d6b328e4296e14355178d3a79778 (diff)
downloadcpython-7fcace99bbe1716c3e9713804e5bffaebdc8dd8f.tar.gz
cpython-7fcace99bbe1716c3e9713804e5bffaebdc8dd8f.zip
GH-125413: Add private metadata methods to `pathlib.Path.info` (#129897)
Add the following private methods to `pathlib.Path.info`: - `_posix_permissions()`: the POSIX file permissions (`S_IMODE(st_mode)`) - `_file_id()`: the file ID (`(st_dev, st_ino)`) - `_access_time_ns()`: the access time in nanoseconds (`st_atime_ns`) - `_mod_time_ns()`: the modify time in nanoseconds (`st_mtime_ns`) - `_bsd_flags()`: the BSD file flags (`st_flags`) - `_xattrs()`: the file extended attributes as a list of key, value pairs, or an empty list if `listxattr()` or `getxattr()` fail in an ignorable way. These methods replace `LocalCopyReader.read_metadata()`, and so we can delete the `CopyReader` and `LocalCopyReader` classes. Rather than reading metadata via `source._copy_reader.read_metadata()`, we instead call `source.info._posix_permissions()`, `_access_time_ns()`, etc. Preserving metadata is only supported for local-to-local copies at the moment. To support copying metadata between arbitrary `ReadablePath` and `WritablePath` objects, we'd need to make the new methods public and documented. Co-authored-by: Petr Viktorin <encukou@gmail.com>
Diffstat (limited to 'Lib/test/test_pathlib/test_pathlib_abc.py')
0 files changed, 0 insertions, 0 deletions