Skip to content

Commit 3b0abb0

Browse files
giampaolomethane
authored andcommitted
bpo-33671: allow setting shutil.copyfile() bufsize globally (GH-12016)
1 parent ef4ac96 commit 3b0abb0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/shutil.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,11 @@ def _copyfileobj_readinto(fsrc, fdst, length=COPY_BUFSIZE):
187187
else:
188188
fdst_write(mv)
189189

190-
def copyfileobj(fsrc, fdst, length=COPY_BUFSIZE):
190+
def copyfileobj(fsrc, fdst, length=0):
191191
"""copy data from file-like object fsrc to file-like object fdst"""
192192
# Localize variable access to minimize overhead.
193+
if not length:
194+
length = COPY_BUFSIZE
193195
fsrc_read = fsrc.read
194196
fdst_write = fdst.write
195197
while True:

0 commit comments

Comments
 (0)