gh-142407: Clarify copy performance on Windows in shutil docs (GH-142408)

This commit is contained in:
NewUserHa 2026-02-06 01:45:14 +08:00 committed by GitHub
parent 7e777c587f
commit d9a2e587fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -540,7 +540,9 @@ On Solaris :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
:func:`shutil.copyfileobj` is used.
:func:`shutil.copyfileobj` is used, which is still reads and writes in a loop.
:func:`shutil.copy2` uses the native ``CopyFile2`` call on Windows, which is the most
efficient method, supports copy-on-write, and preserves metadata.
If the fast-copy operation fails and no data was written in the destination
file then shutil will silently fallback on using less efficient