Skip to content

Commit c840470

Browse files
committed
Remove npy<2 compatibility for ndarray_c_version
1 parent 92301e7 commit c840470

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pytensor/link/c/basic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from io import StringIO
1111
from typing import TYPE_CHECKING, Any, Optional
1212

13+
from numpy._core._multiarray_umath import _get_ndarray_c_version
14+
1315
from pytensor.compile.compilelock import lock_ctx
1416
from pytensor.configdefaults import config
1517
from pytensor.graph.basic import (
@@ -29,7 +31,6 @@
2931
from pytensor.link.c.cmodule import get_module_cache as _get_module_cache
3032
from pytensor.link.c.interface import CLinkerObject, CLinkerOp, CLinkerType
3133
from pytensor.link.utils import gc_helper, map_storage, raise_with_op, streamline
32-
from pytensor.npy_2_compat import ndarray_c_version
3334
from pytensor.utils import difference, uniq
3435

3536

@@ -1367,6 +1368,7 @@ def cmodule_key_(
13671368

13681369
# We must always add the numpy ABI version here as
13691370
# DynamicModule always add the include <numpy/arrayobject.h>
1371+
ndarray_c_version = _get_ndarray_c_version()
13701372
sig.append(f"NPY_ABI_VERSION=0x{ndarray_c_version:X}")
13711373
if c_compiler:
13721374
sig.append("c_compiler_str=" + c_compiler.version_str())

pytensor/npy_2_compat.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
using_numpy_2 = numpy_version >= "2.0.0rc1"
1111

1212

13-
if using_numpy_2:
14-
ndarray_c_version = np._core._multiarray_umath._get_ndarray_c_version() # type: ignore[attr-defined]
15-
else:
16-
ndarray_c_version = np.core._multiarray_umath._get_ndarray_c_version() # type: ignore[attr-defined]
1713

1814

1915
# function that replicates np.unique from numpy < 2.0

0 commit comments

Comments
 (0)