summaryrefslogtreecommitdiff
path: root/dev-python/blosc/files/blosc-1.11.1-numpy-2.patch
blob: 97010c0a4bf69bcd74871b30bf74d1f35e882064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 4823cb746023821166756322becd3fc242cd0b32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sun, 16 Jun 2024 08:59:36 +0200
Subject: [PATCH] Fix test failures with NumPy 2

* Replace deprecated `np.alltrue()` with `np.all()` (available since
  NumPy 1.7.0).

* Cast NumPy boolean to `bool()`, to ensure doctests pass both with
  NumPy 2 (using `np.True_`) and NumPy 1 (using plain `True`).
---
 blosc/toplevel.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/blosc/toplevel.py b/blosc/toplevel.py
index ad9c12d..4d2d413 100644
--- a/blosc/toplevel.py
+++ b/blosc/toplevel.py
@@ -514,7 +514,7 @@ def compress_ptr(address, items, typesize=8, clevel=9, shuffle=blosc.SHUFFLE,
         items, np_array.dtype.itemsize)
     >>> d = blosc.decompress(c)
     >>> np_ans = numpy.fromstring(d, dtype=np_array.dtype)
-    >>> (np_array == np_ans).all()
+    >>> bool((np_array == np_ans).all())
     True
 
     >>> import ctypes
@@ -640,7 +640,7 @@ def decompress_ptr(bytes_like, address):
         items, np_array.dtype.itemsize)
     >>> np_ans = numpy.empty(items, dtype=np_array.dtype)
     >>> nbytes = blosc.decompress_ptr(c, np_ans.__array_interface__['data'][0])
-    >>> (np_array == np_ans).all()
+    >>> bool((np_array == np_ans).all())
     True
     >>> nbytes == items * np_array.dtype.itemsize
     True
@@ -769,12 +769,12 @@ def unpack_array(packed_array, **kwargs):
     >>> len(parray) < a.size*a.itemsize
     True
     >>> a2 = blosc.unpack_array(parray)
-    >>> numpy.alltrue(a == a2)
+    >>> bool(numpy.all(a == a2))
     True
     >>> a = numpy.array(['å', 'ç', 'ø'])
     >>> parray = blosc.pack_array(a)
     >>> a2 = blosc.unpack_array(parray)
-    >>> numpy.alltrue(a == a2)
+    >>> bool(numpy.all(a == a2))
     True
     """