diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2018-06-19 15:27:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-19 15:27:29 (GMT) |
commit | c7f02a965936f197354d7f4e6360f4cfc86817ed (patch) | |
tree | 9402cdb5daa1881eefce00dbc70c8b2dfc7f40f7 /Doc/library/shutil.rst | |
parent | 936f03e7fafc28fd6fdfba11d162c776b89c0167 (diff) | |
download | cpython-c7f02a965936f197354d7f4e6360f4cfc86817ed.zip cpython-c7f02a965936f197354d7f4e6360f4cfc86817ed.tar.gz cpython-c7f02a965936f197354d7f4e6360f4cfc86817ed.tar.bz2 |
bpo-33671 / shutil.copyfile: use memoryview() with dynamic size on Windows (#7681)
bpo-33671
* use memoryview() with size == file size on Windows, see https://github.com/python/cpython/pull/7160#discussion_r195405230
* release intermediate (sliced) memoryview immediately
* replace "OSX" occurrences with "macOS"
* add some unittests for copyfileobj()
Diffstat (limited to 'Doc/library/shutil.rst')
-rw-r--r-- | Doc/library/shutil.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index a3b87ee..c692cf4 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -407,11 +407,15 @@ efficiently (see :issue:`33671`). "fast-copy" means that the copying operation occurs within the kernel, avoiding the use of userspace buffers in Python as in "``outfd.write(infd.read())``". -On OSX `fcopyfile`_ is used to copy the file content (not metadata). +On macOS `fcopyfile`_ is used to copy the file content (not metadata). 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 16 KiB) and a :func:`memoryview`-based variant of +:func:`shutil.copyfileobj` is used. + If the fast-copy operation fails and no data was written in the destination file then shutil will silently fallback on using less efficient :func:`copyfileobj` function internally. |