Skip to content

Commit 2e0f950

Browse files
authored
(fix): ensure no typesize in the Blosc config (#739)
* (fix): ensure no `typesize` in the `Blosc` config * (fix): `typesize` less than 1 test needs to set private member * (chore): document change * (fix): not link for `get_config`
1 parent 936f4d2 commit 2e0f950

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

docs/release.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Fixes
4040
* Add ``#ifndef`` guard around ``PyBytes_RESIZE``.
4141
By :user:`John Kirkham <jakirkham>`, :issue:`732`
4242

43+
* Remove ``typesize`` from ``Blosc.get_config`` output
44+
By :user:`Ilan Gold <ilan-gold>`
45+
4346
Maintenance
4447
~~~~~~~~~~~
4548

numcodecs/blosc.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,11 +489,11 @@ class Blosc(Codec):
489489
self.clevel = clevel
490490
self.shuffle = shuffle
491491
self.blocksize = blocksize
492-
self.typesize = typesize
492+
self._typesize = typesize
493493

494494
def encode(self, buf):
495495
buf = ensure_contiguous_ndarray(buf, self.max_buffer_size)
496-
return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize, self.typesize)
496+
return compress(buf, self._cname_bytes, self.clevel, self.shuffle, self.blocksize, self._typesize)
497497

498498
def decode(self, buf, out=None):
499499
buf = ensure_contiguous_ndarray(buf, self.max_buffer_size)

numcodecs/tests/test_blosc.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,13 @@ def test_typesize_less_than_1():
278278
Blosc(shuffle=Blosc.SHUFFLE, typesize=0)
279279
compressor = Blosc(shuffle=Blosc.SHUFFLE)
280280
# not really something that should be done in practice, but good for testing.
281-
compressor.typesize = 0
281+
compressor._typesize = 0
282282
arr = np.arange(100)
283283
with pytest.raises(ValueError, match=r"Cannot use typesize"):
284284
compressor.encode(arr.tobytes())
285+
286+
287+
def test_config_no_typesize():
288+
codec = Blosc(shuffle=Blosc.SHUFFLE, typesize=5)
289+
config = codec.get_config()
290+
assert "typesize" not in config

0 commit comments

Comments
 (0)