Skip to content

Commit 4ee139d

Browse files
authored
Update shutil.rst to clarify Windows copy behavior
Clarify the behavior of shutil.copyfile and shutil.copy2 on Windows, including buffer size and efficiency.
1 parent 3db7bf2 commit 4ee139d

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 read and write in a loop.
544+
:func:`shutil.copy2` uses native call `CopyFile2` on windows and it is the most
545+
efficient and support copy-on-write, but preserve the 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)