From: Giampaolo Rodola Date: Sun, 24 Feb 2019 23:46:40 +0000 (-0800) Subject: bpo-33671: allow setting shutil.copyfile() bufsize globally (GH-12016) X-Git-Tag: v3.8.0a2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3b0abb019662e42070f1d6f7e74440afb1808f03;p=thirdparty%2FPython%2Fcpython.git bpo-33671: allow setting shutil.copyfile() bufsize globally (GH-12016) --- diff --git a/Lib/shutil.py b/Lib/shutil.py index 065e08bc5c34..29e7564622e1 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: