@@ -363,7 +363,7 @@ cdef extern from "numpy/arrayobject.h":
363363 # Instead, we use properties that map to the corresponding C-API functions.
364364
365365 @property
366- cdef inline PyObject* base(self ) nogil:
366+ cdef inline PyObject* base(self ) noexcept nogil:
367367 """ Returns a borrowed reference to the object owning the data/memory.
368368 """
369369 return PyArray_BASE(self )
@@ -375,34 +375,34 @@ cdef extern from "numpy/arrayobject.h":
375375 return < dtype> PyArray_DESCR(self )
376376
377377 @property
378- cdef inline int ndim(self ) nogil:
378+ cdef inline int ndim(self ) noexcept nogil:
379379 """ Returns the number of dimensions in the array.
380380 """
381381 return PyArray_NDIM(self )
382382
383383 @property
384- cdef inline npy_intp * shape(self ) nogil:
384+ cdef inline npy_intp * shape(self ) noexcept nogil:
385385 """ Returns a pointer to the dimensions/shape of the array.
386386 The number of elements matches the number of dimensions of the array (ndim).
387387 Can return NULL for 0-dimensional arrays.
388388 """
389389 return PyArray_DIMS(self )
390390
391391 @property
392- cdef inline npy_intp * strides(self ) nogil:
392+ cdef inline npy_intp * strides(self ) noexcept nogil:
393393 """ Returns a pointer to the strides of the array.
394394 The number of elements matches the number of dimensions of the array (ndim).
395395 """
396396 return PyArray_STRIDES(self )
397397
398398 @property
399- cdef inline npy_intp size(self ) nogil:
399+ cdef inline npy_intp size(self ) noexcept nogil:
400400 """ Returns the total size (in number of elements) of the array.
401401 """
402402 return PyArray_SIZE(self )
403403
404404 @property
405- cdef inline char * data(self ) nogil:
405+ cdef inline char * data(self ) noexcept nogil:
406406 """ The pointer to the data buffer as a char*.
407407 This is provided for legacy reasons to avoid direct struct field access.
408408 For new code that needs this access, you probably want to cast the result
@@ -1007,7 +1007,7 @@ cdef extern from "numpy/ufuncobject.h":
10071007
10081008 int _import_umath() except - 1
10091009
1010- cdef inline void set_array_base(ndarray arr, object base):
1010+ cdef inline void set_array_base(ndarray arr, object base) except * :
10111011 Py_INCREF(base) # important to do this before stealing the reference below!
10121012 PyArray_SetBaseObject(arr, base)
10131013
@@ -1038,7 +1038,7 @@ cdef inline int import_ufunc() except -1:
10381038 raise ImportError (" numpy._core.umath failed to import" )
10391039
10401040
1041- cdef inline bint is_timedelta64_object(object obj):
1041+ cdef inline bint is_timedelta64_object(object obj) noexcept :
10421042 """
10431043 Cython equivalent of `isinstance(obj, np.timedelta64)`
10441044
@@ -1053,7 +1053,7 @@ cdef inline bint is_timedelta64_object(object obj):
10531053 return PyObject_TypeCheck(obj, & PyTimedeltaArrType_Type)
10541054
10551055
1056- cdef inline bint is_datetime64_object(object obj):
1056+ cdef inline bint is_datetime64_object(object obj) noexcept :
10571057 """
10581058 Cython equivalent of `isinstance(obj, np.datetime64)`
10591059
@@ -1068,7 +1068,7 @@ cdef inline bint is_datetime64_object(object obj):
10681068 return PyObject_TypeCheck(obj, & PyDatetimeArrType_Type)
10691069
10701070
1071- cdef inline npy_datetime get_datetime64_value(object obj) nogil:
1071+ cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:
10721072 """
10731073 returns the int64 value underlying scalar numpy datetime64 object
10741074
@@ -1078,14 +1078,14 @@ cdef inline npy_datetime get_datetime64_value(object obj) nogil:
10781078 return (< PyDatetimeScalarObject* > obj).obval
10791079
10801080
1081- cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:
1081+ cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:
10821082 """
10831083 returns the int64 value underlying scalar numpy timedelta64 object
10841084 """
10851085 return (< PyTimedeltaScalarObject* > obj).obval
10861086
10871087
1088- cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:
1088+ cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:
10891089 """
10901090 returns the unit part of the dtype for a numpy datetime64 object.
10911091 """
0 commit comments