Skip to content

Commit

Permalink
allow_empty is the default in >=zstandard-0.9 (#355)
Browse files Browse the repository at this point in the history
* allow_empty is the default in >=zstandard-0.9

* add comment
  • Loading branch information
thrasibule authored and martindurant committed Aug 6, 2018
1 parent 14a6af6 commit 8182b7b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fastparquet/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ def zstd_decompress(data, uncompressed_size):
def zstd_compress(data, **kwargs):
kwargs['write_content_size'] = False
cctx = zstd.ZstdCompressor(**kwargs)
return cctx.compress(data, allow_empty=True)
try:
return cctx.compress(data, allow_empty=True)
except TypeError:
# zstandard-0.9 removed allow_empy and made it the default.
return cctx.compress(data)
def zstd_decompress(data, uncompressed_size):
dctx = zstd.ZstdDecompressor()
return dctx.decompress(data, max_output_size=uncompressed_size)
Expand Down

0 comments on commit 8182b7b

Please sign in to comment.