]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-33671: allow setting shutil.copyfile() bufsize globally (GH-12016)
authorGiampaolo Rodola <g.rodola@gmail.com>
Sun, 24 Feb 2019 23:46:40 +0000 (15:46 -0800)
committerInada Naoki <methane@users.noreply.github.com>
Sun, 24 Feb 2019 23:46:40 +0000 (08:46 +0900)
Lib/shutil.py

index 065e08bc5c343e805d00fa7fd85b6dd4122d9f71..29e7564622e1f26b7881ebd5018886828c51bc03 100644 (file)
@@ -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: