Fix shutil.copyfileobj monkey patching

This commit is contained in:
Labrys of Knossos 2019-01-05 17:02:03 -05:00
commit 5c644890e8
2 changed files with 13 additions and 9 deletions

View file

@ -0,0 +1,11 @@
from functools import partial
import shutil
from six import PY2
def monkey_patch(length=512 * 1024):
if PY2:
# On Python 2 monkey patch shutil.copyfileobj()
# to adjust the buffer length to 512KB rather than 4KB
original_copyfileobj = shutil.copyfileobj
shutil.copyfileobj = partial(original_copyfileobj, length=length)