Skip to content

Commit d9a2e58

Browse files
authored
gh-142407: Clarify copy performance on Windows in shutil docs (GH-142408)
1 parent 7e777c5 commit d9a2e58

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/library/shutil.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,9 @@ On Solaris :func:`os.sendfile` is used.
540540

541541
On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB
542542
instead of 64 KiB) and a :func:`memoryview`-based variant of
543-
:func:`shutil.copyfileobj` is used.
543+
:func:`shutil.copyfileobj` is used, which is still reads and writes in a loop.
544+
:func:`shutil.copy2` uses the native ``CopyFile2`` call on Windows, which is the most
545+
efficient method, supports copy-on-write, and preserves metadata.
544546

545547
If the fast-copy operation fails and no data was written in the destination
546548
file then shutil will silently fallback on using less efficient

0 commit comments

Comments
 (0)