summaryrefslogtreecommitdiffstats
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-07-06 16:18:39 (GMT)
committerGitHub <noreply@github.com>2024-07-06 16:18:39 (GMT)
commit88fc0655d4a487233efce293277690a799706bf9 (patch)
treed39326c16c0d1881a0ba6663ed6c132b18de9d0b /Python/executor_cases.c.h
parent6239d41527d5977aa5d44e4b894d719bc045860e (diff)
downloadcpython-88fc0655d4a487233efce293277690a799706bf9.zip
cpython-88fc0655d4a487233efce293277690a799706bf9.tar.gz
cpython-88fc0655d4a487233efce293277690a799706bf9.tar.bz2
GH-73991: Support preserving metadata in `pathlib.Path.copy()` (#120806)
Add *preserve_metadata* keyword-only argument to `pathlib.Path.copy()`, defaulting to false. When set to true, we copy timestamps, permissions, extended attributes and flags where available, like `shutil.copystat()`. The argument has no effect on Windows, where metadata is always copied. Internally (in the pathlib ABCs), path types gain `_readable_metadata` and `_writable_metadata` attributes. These sets of strings describe what kinds of metadata can be retrieved and stored. We take an intersection of `source._readable_metadata` and `target._writable_metadata` to minimise reads/writes. A new `_read_metadata()` method accepts a set of metadata keys and returns a dict with those keys, and a new `_write_metadata()` method accepts a dict of metadata. We *might* make these public in future, but it's hard to justify while the ABCs are still private.
Diffstat (limited to 'Python/executor_cases.c.h')
0 files changed, 0 insertions, 0 deletions