From 8bf3915dc783baebcb89c46f0a6947f683692593 Mon Sep 17 00:00:00 2001 From: ilan-gold Date: Sun, 13 Apr 2025 12:17:51 +0200 Subject: [PATCH 1/4] (fix): ensure no `typesize` in the `Blosc` config --- numcodecs/blosc.pyx | 4 ++-- numcodecs/tests/test_blosc.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/numcodecs/blosc.pyx b/numcodecs/blosc.pyx index 6ec72e21..ddc29e1a 100644 --- a/numcodecs/blosc.pyx +++ b/numcodecs/blosc.pyx @@ -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) diff --git a/numcodecs/tests/test_blosc.py b/numcodecs/tests/test_blosc.py index 81725018..07e9c5c2 100644 --- a/numcodecs/tests/test_blosc.py +++ b/numcodecs/tests/test_blosc.py @@ -282,3 +282,9 @@ def test_typesize_less_than_1(): 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 From 334a05cd51f4696b4c905459ddcc807cbdbc4fca Mon Sep 17 00:00:00 2001 From: ilan-gold Date: Sun, 13 Apr 2025 12:24:25 +0200 Subject: [PATCH 2/4] (fix): `typesize` less than 1 test needs to set private member --- numcodecs/tests/test_blosc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numcodecs/tests/test_blosc.py b/numcodecs/tests/test_blosc.py index 07e9c5c2..52ef183a 100644 --- a/numcodecs/tests/test_blosc.py +++ b/numcodecs/tests/test_blosc.py @@ -278,7 +278,7 @@ 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()) From 198132416d43fed8fd3d31f143330d5245166d4c Mon Sep 17 00:00:00 2001 From: ilan-gold Date: Sun, 13 Apr 2025 12:30:56 +0200 Subject: [PATCH 3/4] (chore): document change --- docs/release.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release.rst b/docs/release.rst index bda2f867..10deb57e 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -38,6 +38,9 @@ Fixes * Add ``#ifndef`` guard around ``PyBytes_RESIZE``. By :user:`John Kirkham `, :issue:`732` +* Remove ``typesize`` from :func:`Blosc.get_config` output + By :user:`Ilan Gold ` + Maintenance ~~~~~~~~~~~ From b93952addb19a6d388ebee5bbcc305cc054a9049 Mon Sep 17 00:00:00 2001 From: ilan-gold Date: Sun, 13 Apr 2025 12:36:23 +0200 Subject: [PATCH 4/4] (fix): not link for `get_config` --- docs/release.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index 10deb57e..3638584b 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -38,7 +38,7 @@ Fixes * Add ``#ifndef`` guard around ``PyBytes_RESIZE``. By :user:`John Kirkham `, :issue:`732` -* Remove ``typesize`` from :func:`Blosc.get_config` output +* Remove ``typesize`` from ``Blosc.get_config`` output By :user:`Ilan Gold ` Maintenance