Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ 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.10.0-dev
------------------
+ Fix pickling of ``isal_zlib.error`` (``igzip_lib.IsalError``). An error
raised in a ``multiprocessing`` worker process did not reach the parent
process. Tracebacks now show ``isal.igzip_lib.IsalError`` instead of
``igzip_lib.IsalError``.


version 1.9.1
-----------------
+ Fix BrokenPipeError when piping ``python -m isal.igzip`` into ``head``,
Expand Down
3 changes: 2 additions & 1 deletion src/isal/igzip_libmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ PyInit_igzip_lib(void)
#endif


IsalError = PyErr_NewException("igzip_lib.IsalError", NULL, NULL);
/* The full module name lets pickle find the class. */
IsalError = PyErr_NewException("isal.igzip_lib.IsalError", NULL, NULL);
if (IsalError == NULL) {
return NULL;
}
Expand Down
13 changes: 12 additions & 1 deletion tests/test_igzip_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import zlib
from typing import NamedTuple

from isal import igzip_lib
from isal import igzip_lib, isal_zlib
from isal.igzip_lib import (
COMP_DEFLATE, COMP_GZIP, COMP_GZIP_NO_HDR, COMP_ZLIB, COMP_ZLIB_NO_HDR,
DECOMP_DEFLATE, DECOMP_GZIP, DECOMP_GZIP_NO_HDR, DECOMP_GZIP_NO_HDR_VER,
Expand Down Expand Up @@ -239,6 +239,17 @@ def test_failure(self):
with pytest.raises(igzip_lib.IsalError):
igzd.decompress(self.BAD_DATA * 30)

@pytest.mark.parametrize("module", [igzip_lib, isal_zlib])
def test_failure_pickle(self, module):
# multiprocessing pickles an error raised in a worker process to send
# it to the parent process.
with pytest.raises(igzip_lib.IsalError) as raised:
module.decompress(self.BAD_DATA)
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
error = pickle.loads(pickle.dumps(raised.value, proto))
assert type(error) is igzip_lib.IsalError
assert error.args == raised.value.args

def test_dictionary(self):
compressor = zlib.compressobj(zdict=b"bla")
data = compressor.compress(b"bladiebla") + compressor.flush()
Expand Down
Loading