diff --git a/CHANGELOG.rst b/CHANGELOG.rst index de602380..c6e57dba 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,11 @@ Changelog .. This document is user facing. Please word the changes in such a way .. that users understand how the changes affect the new version. +version 1.6.0-dev +----------------- ++ Fix an error that occurred in the ``__close__`` function when a threaded + writer was initialized with incorrect parameters. + version 1.5.3 ----------------- + Fix a bug where append mode would not work when using diff --git a/src/isal/igzip_threaded.py b/src/isal/igzip_threaded.py index 99eafc17..adb2c24d 100644 --- a/src/isal/igzip_threaded.py +++ b/src/isal/igzip_threaded.py @@ -204,6 +204,9 @@ def __init__(self, queue_size: int = 1, block_size: int = 1024 * 1024, ): + # File should be closed during init, so __exit__ method does not + # touch the self.raw value before it is initialized. + self._closed = True if "t" in mode or "r" in mode: raise ValueError("Only binary writing is supported") if "b" not in mode: @@ -243,8 +246,8 @@ def __init__(self, self._crc = 0 self.running = False self._size = 0 - self._closed = False self.raw = open_as_binary_stream(filename, mode) + self._closed = False self._write_gzip_header() self.start()