Skip to content

Commit 86d2f72

Browse files
committed
set keyword argument so zipfile actually compresses
1 parent bc37ea2 commit 86d2f72

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/io/common.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import codecs
66
import mmap
77
from contextlib import contextmanager, closing
8-
from zipfile import ZipFile
8+
import zipfile
99

1010
from pandas.compat import StringIO, BytesIO, string_types, text_type
1111
from pandas import compat
@@ -428,7 +428,7 @@ def _get_handle(path_or_buf, mode, encoding=None, compression=None,
428428
return f, handles
429429

430430

431-
class BytesZipFile(ZipFile, BytesIO):
431+
class BytesZipFile(zipfile.ZipFile, BytesIO):
432432
"""
433433
Wrapper for standard library class ZipFile and allow the returned file-like
434434
handle to accept byte strings via `write` method.
@@ -437,10 +437,10 @@ class BytesZipFile(ZipFile, BytesIO):
437437
bytes strings into a member of the archive.
438438
"""
439439
# GH 17778
440-
def __init__(self, file, mode='r', **kwargs):
440+
def __init__(self, file, mode, compression=zipfile.ZIP_DEFLATED, **kwargs):
441441
if mode in ['wb', 'rb']:
442442
mode = mode.replace('b', '')
443-
super(BytesZipFile, self).__init__(file, mode, **kwargs)
443+
super(BytesZipFile, self).__init__(file, mode, compression, **kwargs)
444444

445445
def write(self, data):
446446
super(BytesZipFile, self).writestr(self.filename, data)

0 commit comments

Comments
 (0)