cpython/Lib/test/test_pathlib
Barney Gale 7c38097add
GH-73991: Add `pathlib.Path.copy()` (#119058)
Add a `Path.copy()` method that copies the content of one file to another.

This method is similar to `shutil.copyfile()` but differs in the following ways:

- Uses `fcntl.FICLONE` where available (see GH-81338)
- Uses `os.copy_file_range` where available (see GH-81340)
- Uses `_winapi.CopyFile2` where available, even though this copies more metadata than the other implementations. This makes `WindowsPath.copy()` more similar to `shutil.copy2()`.

The method is presently _less_ specified than the `shutil` functions to allow OS-specific optimizations that might copy more or less metadata.

Incorporates code from GH-81338 and GH-93152.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2024-06-14 17:15:49 +01:00
..
__init__.py
test_pathlib.py GH-74033: Drop deprecated `pathlib.Path` keyword arguments (#118793) 2024-05-14 20:14:07 +00:00
test_pathlib_abc.py GH-73991: Add `pathlib.Path.copy()` (#119058) 2024-06-14 17:15:49 +01:00