Skip to content

Commit 80b9c88

Browse files
committed
MNT support array functions in numpy>=1.25
1 parent 795600e commit 80b9c88

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

skops/io/_numpy.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,17 @@ def _construct(self):
256256
(np.random.RandomState, random_state_get_state),
257257
(np.random.Generator, random_generator_get_state),
258258
]
259+
260+
try:
261+
# From numpy=1.25.0 dispatching for `__array_function__` is done via
262+
# a C wrapper: https://github.com/numpy/numpy/pull/23020
263+
from numpy.core._multiarray_umath import _ArrayFunctionDispatcher
264+
265+
GET_STATE_DISPATCH_FUNCTIONS.append((_ArrayFunctionDispatcher, function_get_state))
266+
except ImportError:
267+
pass
268+
269+
259270
# tuples of type and function that creates the instance of that type
260271
NODE_TYPE_MAPPING = {
261272
("NdArrayNode", PROTOCOL): NdArrayNode,

0 commit comments

Comments
 (0)