Skip to content

Commit

Permalink
Ignore bad compression level
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Dec 24, 2023
1 parent e82b50c commit 20743c5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/xopen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,13 +1070,16 @@ def _open_gz( # noqa: C901
except ValueError: # Wrong compression level
pass
if gzip_ng_threaded and threads != 0:
return gzip_ng_threaded.open(
filename,
mode,
zlib_ng.Z_DEFAULT_COMPRESSION if compresslevel is None else compresslevel,
**text_mode_kwargs,
threads=1 if threads is None else threads,
)
try:
return gzip_ng_threaded.open(
filename,
mode,
zlib_ng.Z_DEFAULT_COMPRESSION if compresslevel is None else compresslevel,
**text_mode_kwargs,
threads=1 if threads is None else threads,
)
except zlib_ng.error: # Bad compression level
pass
if threads != 0:
try:
if "r" in mode:
Expand Down

0 comments on commit 20743c5

Please sign in to comment.