]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-130614: pathlib ABCs: improve support for receiving path metadata (#131259)
authorBarney Gale <barney.gale@gmail.com>
Sun, 16 Mar 2025 06:11:20 +0000 (06:11 +0000)
committerGitHub <noreply@github.com>
Sun, 16 Mar 2025 06:11:20 +0000 (06:11 +0000)
commit563ab5cefe98d3a4a8f86eb46ca5aeaeaa5b120b
tree452567cb55bb2adeedb338b7dc9fa67ba011979a
parente82c2ca2a59235bc1965b259f4421635861e0470
GH-130614: pathlib ABCs: improve support for receiving path metadata (#131259)

In the private pathlib ABCs, replace `_WritablePath._write_info()` with
`_WritablePath._copy_from()`. This provides the target path object with
more control over the copying process, including support for querying and
setting metadata *before* the path is created.

Adjust `_ReadablePath.copy()` so that it forwards its keyword arguments to
`_WritablePath._copy_from()` of the target path object. This allows us to
remove the unimplemented *preserve_metadata* argument in the ABC method,
making it a `Path` exclusive.
Lib/pathlib/__init__.py
Lib/pathlib/_os.py
Lib/pathlib/types.py