diff --git a/docs/release.rst b/docs/release.rst index a3b47185..96c90bb0 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -11,6 +11,14 @@ Release notes Unreleased ---------- +Breaking changes +~~~~~~~~~~~~~~~~ +* `Zstd.default_level`, `Zstd.min_level`, and `Zstd.max_level` are now class methods + instead of properties. This means they must now be called like ``Zstd.default_level()`` + instead of ``Zstd.default_level``. This breaking change has been made because Python 3.13 + removes support for class properties. + By :user:`David Stansby ` + Enhancements ~~~~~~~~~~~~ diff --git a/numcodecs/tests/test_zstd.py b/numcodecs/tests/test_zstd.py index d5646c2d..4e92d31a 100644 --- a/numcodecs/tests/test_zstd.py +++ b/numcodecs/tests/test_zstd.py @@ -90,6 +90,6 @@ def test_checksum(): def test_native_functions(): # Note, these assertions might need to be changed for new versions of zstd - assert Zstd.default_level == 3 - assert Zstd.min_level == -131072 - assert Zstd.max_level == 22 + assert Zstd.default_level() == 3 + assert Zstd.min_level() == -131072 + assert Zstd.max_level() == 22 diff --git a/numcodecs/zstd.pyx b/numcodecs/zstd.pyx index fab6ed2b..efd12fa2 100644 --- a/numcodecs/zstd.pyx +++ b/numcodecs/zstd.pyx @@ -28,8 +28,8 @@ cdef extern from "zstd.h": ZSTD_CCtx* ZSTD_createCCtx() nogil size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx) nogil - size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, - ZSTD_cParameter param, + size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, + ZSTD_cParameter param, int value) nogil size_t ZSTD_compress2(ZSTD_CCtx* cctx, @@ -235,7 +235,7 @@ class Zstd(Codec): """ codec_id = 'zstd' - + # Note: unlike the LZ4 and Blosc codecs, there does not appear to be a (currently) # practical limit on the size of buffers that Zstd can process and so we don't # enforce a max_buffer_size option here. @@ -259,19 +259,16 @@ class Zstd(Codec): return r @classmethod - @property def default_level(cls): """Returns the default compression level of the underlying zstd library.""" return ZSTD_defaultCLevel() @classmethod - @property def min_level(cls): """Returns the minimum compression level of the underlying zstd library.""" return ZSTD_minCLevel() @classmethod - @property def max_level(cls): """Returns the maximum compression level of the underlying zstd library.""" return ZSTD_maxCLevel()