Skip to content

(fix): ensure no typesize in the Blosc config #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Fixes
* Add ``#ifndef`` guard around ``PyBytes_RESIZE``.
By :user:`John Kirkham <jakirkham>`, :issue:`732`

* Remove ``typesize`` from ``Blosc.get_config`` output
By :user:`Ilan Gold <ilan-gold>`

Maintenance
~~~~~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions numcodecs/blosc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,11 @@ class Blosc(Codec):
self.clevel = clevel
self.shuffle = shuffle
self.blocksize = blocksize
self.typesize = typesize
self._typesize = typesize

def encode(self, buf):
buf = ensure_contiguous_ndarray(buf, self.max_buffer_size)
return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize, self.typesize)
return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize, self._typesize)

def decode(self, buf, out=None):
buf = ensure_contiguous_ndarray(buf, self.max_buffer_size)
Expand Down
8 changes: 7 additions & 1 deletion numcodecs/tests/test_blosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,13 @@ def test_typesize_less_than_1():
Blosc(shuffle=Blosc.SHUFFLE, typesize=0)
compressor = Blosc(shuffle=Blosc.SHUFFLE)
# not really something that should be done in practice, but good for testing.
compressor.typesize = 0
compressor._typesize = 0
arr = np.arange(100)
with pytest.raises(ValueError, match=r"Cannot use typesize"):
compressor.encode(arr.tobytes())


def test_config_no_typesize():
codec = Blosc(shuffle=Blosc.SHUFFLE, typesize=5)
config = codec.get_config()
assert "typesize" not in config
Loading