@@ -242,7 +242,7 @@ cdef extern from "numpy/arrayobject.h":
242242 # Instead, we use properties that map to the corresponding C-API functions.
243243
244244 @property
245- cdef inline PyObject* base(self ) nogil:
245+ cdef inline PyObject* base(self ) noexcept nogil:
246246 """ Returns a borrowed reference to the object owning the data/memory.
247247 """
248248 return PyArray_BASE(self )
@@ -254,34 +254,34 @@ cdef extern from "numpy/arrayobject.h":
254254 return < dtype> PyArray_DESCR(self )
255255
256256 @property
257- cdef inline int ndim(self ) nogil:
257+ cdef inline int ndim(self ) noexcept nogil:
258258 """ Returns the number of dimensions in the array.
259259 """
260260 return PyArray_NDIM(self )
261261
262262 @property
263- cdef inline npy_intp * shape(self ) nogil:
263+ cdef inline npy_intp * shape(self ) noexcept nogil:
264264 """ Returns a pointer to the dimensions/shape of the array.
265265 The number of elements matches the number of dimensions of the array (ndim).
266266 Can return NULL for 0-dimensional arrays.
267267 """
268268 return PyArray_DIMS(self )
269269
270270 @property
271- cdef inline npy_intp * strides(self ) nogil:
271+ cdef inline npy_intp * strides(self ) noexcept nogil:
272272 """ Returns a pointer to the strides of the array.
273273 The number of elements matches the number of dimensions of the array (ndim).
274274 """
275275 return PyArray_STRIDES(self )
276276
277277 @property
278- cdef inline npy_intp size(self ) nogil:
278+ cdef inline npy_intp size(self ) noexcept nogil:
279279 """ Returns the total size (in number of elements) of the array.
280280 """
281281 return PyArray_SIZE(self )
282282
283283 @property
284- cdef inline char * data(self ) nogil:
284+ cdef inline char * data(self ) noexcept nogil:
285285 """ The pointer to the data buffer as a char*.
286286 This is provided for legacy reasons to avoid direct struct field access.
287287 For new code that needs this access, you probably want to cast the result
@@ -965,7 +965,7 @@ cdef extern from "numpy/ufuncobject.h":
965965
966966 int _import_umath() except - 1
967967
968- cdef inline void set_array_base(ndarray arr, object base):
968+ cdef inline void set_array_base(ndarray arr, object base) except * :
969969 Py_INCREF(base) # important to do this before stealing the reference below!
970970 PyArray_SetBaseObject(arr, base)
971971
@@ -996,7 +996,7 @@ cdef inline int import_ufunc() except -1:
996996 raise ImportError (" numpy.core.umath failed to import" )
997997
998998
999- cdef inline bint is_timedelta64_object(object obj):
999+ cdef inline bint is_timedelta64_object(object obj) noexcept :
10001000 """
10011001 Cython equivalent of `isinstance(obj, np.timedelta64)`
10021002
@@ -1011,7 +1011,7 @@ cdef inline bint is_timedelta64_object(object obj):
10111011 return PyObject_TypeCheck(obj, & PyTimedeltaArrType_Type)
10121012
10131013
1014- cdef inline bint is_datetime64_object(object obj):
1014+ cdef inline bint is_datetime64_object(object obj) noexcept :
10151015 """
10161016 Cython equivalent of `isinstance(obj, np.datetime64)`
10171017
@@ -1026,7 +1026,7 @@ cdef inline bint is_datetime64_object(object obj):
10261026 return PyObject_TypeCheck(obj, & PyDatetimeArrType_Type)
10271027
10281028
1029- cdef inline npy_datetime get_datetime64_value(object obj) nogil:
1029+ cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:
10301030 """
10311031 returns the int64 value underlying scalar numpy datetime64 object
10321032
@@ -1036,14 +1036,14 @@ cdef inline npy_datetime get_datetime64_value(object obj) nogil:
10361036 return (< PyDatetimeScalarObject* > obj).obval
10371037
10381038
1039- cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:
1039+ cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:
10401040 """
10411041 returns the int64 value underlying scalar numpy timedelta64 object
10421042 """
10431043 return (< PyTimedeltaScalarObject* > obj).obval
10441044
10451045
1046- cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:
1046+ cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:
10471047 """
10481048 returns the unit part of the dtype for a numpy datetime64 object.
10491049 """
0 commit comments