]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-122890: Fix low-level error handling in `pathlib.Path.copy()` (#122897)
authorBarney Gale <barney.gale@gmail.com>
Sat, 24 Aug 2024 14:11:39 +0000 (15:11 +0100)
committerGitHub <noreply@github.com>
Sat, 24 Aug 2024 14:11:39 +0000 (15:11 +0100)
commitc4ee4e756a311f03633723445299bde90eb7b79c
tree5068b0cc0072af2a4110d7bf200d387dcb792979
parent127660bcdb28294c3817f955cabd85afb6828ffc
GH-122890: Fix low-level error handling in `pathlib.Path.copy()` (#122897)

Give unique names to our low-level FD copying functions, and try each one
in turn. Handle errors appropriately for each implementation:

- `fcntl.FICLONE`: suppress `EBADF`, `EOPNOTSUPP`, `ETXTBSY`, `EXDEV`
- `posix._fcopyfile`: suppress `EBADF`, `ENOTSUP`
- `os.copy_file_range`: suppress `ETXTBSY`, `EXDEV`
- `os.sendfile`: suppress `ENOTSOCK`
Lib/pathlib/_os.py
Lib/test/test_pathlib/test_pathlib.py