Skip to content

Commit c60f80c

Browse files
authored
Convert class properties to class methods (#578)
1 parent 5f4ee48 commit c60f80c

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

docs/release.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ Release notes
1111
Unreleased
1212
----------
1313

14+
Breaking changes
15+
~~~~~~~~~~~~~~~~
16+
* `Zstd.default_level`, `Zstd.min_level`, and `Zstd.max_level` are now class methods
17+
instead of properties. This means they must now be called like ``Zstd.default_level()``
18+
instead of ``Zstd.default_level``. This breaking change has been made because Python 3.13
19+
removes support for class properties.
20+
By :user:`David Stansby <dstansby>`
21+
1422
Enhancements
1523
~~~~~~~~~~~~
1624

numcodecs/tests/test_zstd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ def test_checksum():
9090

9191
def test_native_functions():
9292
# Note, these assertions might need to be changed for new versions of zstd
93-
assert Zstd.default_level == 3
94-
assert Zstd.min_level == -131072
95-
assert Zstd.max_level == 22
93+
assert Zstd.default_level() == 3
94+
assert Zstd.min_level() == -131072
95+
assert Zstd.max_level() == 22

numcodecs/zstd.pyx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ cdef extern from "zstd.h":
2828

2929
ZSTD_CCtx* ZSTD_createCCtx() nogil
3030
size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx) nogil
31-
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx,
32-
ZSTD_cParameter param,
31+
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx,
32+
ZSTD_cParameter param,
3333
int value) nogil
3434

3535
size_t ZSTD_compress2(ZSTD_CCtx* cctx,
@@ -235,7 +235,7 @@ class Zstd(Codec):
235235
"""
236236

237237
codec_id = 'zstd'
238-
238+
239239
# Note: unlike the LZ4 and Blosc codecs, there does not appear to be a (currently)
240240
# practical limit on the size of buffers that Zstd can process and so we don't
241241
# enforce a max_buffer_size option here.
@@ -259,19 +259,16 @@ class Zstd(Codec):
259259
return r
260260

261261
@classmethod
262-
@property
263262
def default_level(cls):
264263
"""Returns the default compression level of the underlying zstd library."""
265264
return ZSTD_defaultCLevel()
266265

267266
@classmethod
268-
@property
269267
def min_level(cls):
270268
"""Returns the minimum compression level of the underlying zstd library."""
271269
return ZSTD_minCLevel()
272270

273271
@classmethod
274-
@property
275272
def max_level(cls):
276273
"""Returns the maximum compression level of the underlying zstd library."""
277274
return ZSTD_maxCLevel()

0 commit comments

Comments
 (0)