Skip to content

Commit 8665e6d

Browse files
committed
Fix refcount test for python 3.14
1 parent bf8a603 commit 8665e6d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/ndarray/test_resize.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,24 @@ def test_expand_dims(shape, axis, chunks, blocks, fill_value):
6666

6767
arr = np.arange(4)
6868
bloscarr_ = blosc2.asarray(arr)
69-
assert sys.getrefcount(arr) == sys.getrefcount(bloscarr_) == 2
69+
# In python 3.14, sys.getrefcount no longer creates "extra" dummy reference itself
70+
py314 = sys.version >= "3.14"
71+
assert sys.getrefcount(arr) == sys.getrefcount(bloscarr_) == 2 - py314
7072

7173
view = np.expand_dims(arr, 0)
7274
bloscview = blosc2.expand_dims(bloscarr_, 0)
73-
assert sys.getrefcount(arr) == sys.getrefcount(bloscarr_) == 3
75+
assert sys.getrefcount(arr) == sys.getrefcount(bloscarr_) == 3 - py314
7476

7577
del view
7678
del bloscview
77-
assert sys.getrefcount(arr) == sys.getrefcount(bloscarr_) == 2
79+
assert sys.getrefcount(arr) == sys.getrefcount(bloscarr_) == 2 - py314
7880

7981
# view of a view
8082
view = np.expand_dims(arr, 0)
8183
bloscview = blosc2.expand_dims(bloscarr_, 0)
8284
view2 = np.expand_dims(view, 0)
8385
bloscview2 = blosc2.expand_dims(bloscview, 0)
84-
assert sys.getrefcount(arr) == sys.getrefcount(bloscarr_) == 4
86+
assert sys.getrefcount(arr) == sys.getrefcount(bloscarr_) == 4 - py314
8587

8688
del bloscview
8789
del bloscarr_

0 commit comments

Comments
 (0)