Skip to content

Commit

Permalink
Do not set threads default globally in the function
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Jan 12, 2024
1 parent e4856ed commit d0758de
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/xopen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,6 @@ def _open_gz( # noqa: C901
# Force the same compression level on every tool regardless of
# library defaults
compresslevel = XOPEN_DEFAULT_GZIP_COMPRESSION
if threads is None:
threads = 1

if threads != 0:
if igzip_threaded:
Expand All @@ -1053,7 +1051,7 @@ def _open_gz( # noqa: C901
mode,
compresslevel,
**text_mode_kwargs,
threads=threads,
threads=threads or max(_available_cpu_count(), 4),
)
except ValueError: # Wrong compression level
pass
Expand All @@ -1067,7 +1065,7 @@ def _open_gz( # noqa: C901
# increase the level
max(compresslevel, 2),
**text_mode_kwargs,
threads=threads,
threads=threads or max(_available_cpu_count(), 4)
)
except zlib_ng.error: # Bad compression level
pass
Expand Down

0 comments on commit d0758de

Please sign in to comment.