All sendfile differences between Linux and Solaris were hopefully taken care of, and hence we can reenable it within the shutil module. This was requested upstream as well: https://bugs.python.org/issue41843 --- Python-3.12.1/Lib/shutil.py.orig +++ Python-3.12.1/Lib/shutil.py @@ -48,7 +48,7 @@ COPY_BUFSIZE = 1024 * 1024 if _WINDOWS else 64 * 1024 # This should never be removed, see rationale in: # https://bugs.python.org/issue43743#msg393429 -_USE_CP_SENDFILE = hasattr(os, "sendfile") and sys.platform.startswith("linux") +_USE_CP_SENDFILE = hasattr(os, "sendfile") _HAS_FCOPYFILE = posix and hasattr(posix, "_fcopyfile") # macOS # CMD defaults in Windows 10 --- Python-3.12.1/Doc/library/shutil.rst.orig +++ Python-3.12.1/Doc/library/shutil.rst @@ -503,7 +503,8 @@ On macOS `fcopyfile`_ is used to copy the file content (not metadata). -On Linux :func:`os.sendfile` is used. +On Linux, Solaris and other POSIX platforms where :func:`os.sendfile` supports +copies between 2 regular file descriptors :func:`os.sendfile` is used. On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB instead of 64 KiB) and a :func:`memoryview`-based variant of