summaryrefslogtreecommitdiffstats
path: root/Lib/shutil.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-02-24 23:46:40 (GMT)
committerInada Naoki <methane@users.noreply.github.com>2019-02-24 23:46:40 (GMT)
commit3b0abb019662e42070f1d6f7e74440afb1808f03 (patch)
treef847d5d5ad51d242fb82b2171b382334ff79eb1b /Lib/shutil.py
parentef4ac967e2f3a9a18330cc6abe14adb4bc3d0465 (diff)
downloadcpython-3b0abb019662e42070f1d6f7e74440afb1808f03.zip
cpython-3b0abb019662e42070f1d6f7e74440afb1808f03.tar.gz
cpython-3b0abb019662e42070f1d6f7e74440afb1808f03.tar.bz2
bpo-33671: allow setting shutil.copyfile() bufsize globally (GH-12016)
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r--Lib/shutil.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 065e08b..29e7564 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -187,9 +187,11 @@ def _copyfileobj_readinto(fsrc, fdst, length=COPY_BUFSIZE):
else:
fdst_write(mv)
-def copyfileobj(fsrc, fdst, length=COPY_BUFSIZE):
+def copyfileobj(fsrc, fdst, length=0):
"""copy data from file-like object fsrc to file-like object fdst"""
# Localize variable access to minimize overhead.
+ if not length:
+ length = COPY_BUFSIZE
fsrc_read = fsrc.read
fdst_write = fdst.write
while True: