Skip to content

Commit 1ec9a76

Browse files
committed
Handle Numpy deprecated API without touching CMake
Instead cdef from `numpy/npy_no_deprecated_api.h`
1 parent d326314 commit 1ec9a76

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

dpctl/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ function(build_dpctl_ext _trgt _src _dest)
125125
)
126126
endif()
127127
endif()
128-
# needed to prevent warnings from Cython caused by cimporting from Numpy
129-
target_compile_definitions(${_trgt} PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
130128
target_link_libraries(${_trgt} PRIVATE Python::NumPy)
131129
if (DPCTL_GENERATE_COVERAGE)
132130
target_compile_definitions(${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1)

dpctl/tensor/_dlpack.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
# cython: language_level=3
1919
# cython: linetrace=True
2020

21+
cdef extern from "numpy/npy_no_deprecated_api.h":
22+
pass
2123
from numpy cimport ndarray
2224

2325
from .._sycl_device cimport SyclDevice

dpctl/tensor/_dlpack.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
# cython: language_level=3
1919
# cython: linetrace=True
2020

21+
cdef extern from "numpy/npy_no_deprecated_api.h":
22+
pass
23+
2124
cimport cpython
2225
from libc cimport stdlib
2326
from libc.stdint cimport int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t

0 commit comments

Comments
 (0)