@@ -363,7 +363,7 @@ cdef extern from "numpy/arrayobject.h":
363
363
# Instead, we use properties that map to the corresponding C-API functions.
364
364
365
365
@property
366
- cdef inline PyObject* base(self ) nogil:
366
+ cdef inline PyObject* base(self ) noexcept nogil:
367
367
""" Returns a borrowed reference to the object owning the data/memory.
368
368
"""
369
369
return PyArray_BASE(self )
@@ -375,34 +375,34 @@ cdef extern from "numpy/arrayobject.h":
375
375
return < dtype> PyArray_DESCR(self )
376
376
377
377
@property
378
- cdef inline int ndim(self ) nogil:
378
+ cdef inline int ndim(self ) noexcept nogil:
379
379
""" Returns the number of dimensions in the array.
380
380
"""
381
381
return PyArray_NDIM(self )
382
382
383
383
@property
384
- cdef inline npy_intp * shape(self ) nogil:
384
+ cdef inline npy_intp * shape(self ) noexcept nogil:
385
385
""" Returns a pointer to the dimensions/shape of the array.
386
386
The number of elements matches the number of dimensions of the array (ndim).
387
387
Can return NULL for 0-dimensional arrays.
388
388
"""
389
389
return PyArray_DIMS(self )
390
390
391
391
@property
392
- cdef inline npy_intp * strides(self ) nogil:
392
+ cdef inline npy_intp * strides(self ) noexcept nogil:
393
393
""" Returns a pointer to the strides of the array.
394
394
The number of elements matches the number of dimensions of the array (ndim).
395
395
"""
396
396
return PyArray_STRIDES(self )
397
397
398
398
@property
399
- cdef inline npy_intp size(self ) nogil:
399
+ cdef inline npy_intp size(self ) noexcept nogil:
400
400
""" Returns the total size (in number of elements) of the array.
401
401
"""
402
402
return PyArray_SIZE(self )
403
403
404
404
@property
405
- cdef inline char * data(self ) nogil:
405
+ cdef inline char * data(self ) noexcept nogil:
406
406
""" The pointer to the data buffer as a char*.
407
407
This is provided for legacy reasons to avoid direct struct field access.
408
408
For new code that needs this access, you probably want to cast the result
@@ -1007,7 +1007,7 @@ cdef extern from "numpy/ufuncobject.h":
1007
1007
1008
1008
int _import_umath() except - 1
1009
1009
1010
- cdef inline void set_array_base(ndarray arr, object base):
1010
+ cdef inline void set_array_base(ndarray arr, object base) except * :
1011
1011
Py_INCREF(base) # important to do this before stealing the reference below!
1012
1012
PyArray_SetBaseObject(arr, base)
1013
1013
@@ -1038,7 +1038,7 @@ cdef inline int import_ufunc() except -1:
1038
1038
raise ImportError (" numpy._core.umath failed to import" )
1039
1039
1040
1040
1041
- cdef inline bint is_timedelta64_object(object obj):
1041
+ cdef inline bint is_timedelta64_object(object obj) noexcept :
1042
1042
"""
1043
1043
Cython equivalent of `isinstance(obj, np.timedelta64)`
1044
1044
@@ -1053,7 +1053,7 @@ cdef inline bint is_timedelta64_object(object obj):
1053
1053
return PyObject_TypeCheck(obj, & PyTimedeltaArrType_Type)
1054
1054
1055
1055
1056
- cdef inline bint is_datetime64_object(object obj):
1056
+ cdef inline bint is_datetime64_object(object obj) noexcept :
1057
1057
"""
1058
1058
Cython equivalent of `isinstance(obj, np.datetime64)`
1059
1059
@@ -1068,7 +1068,7 @@ cdef inline bint is_datetime64_object(object obj):
1068
1068
return PyObject_TypeCheck(obj, & PyDatetimeArrType_Type)
1069
1069
1070
1070
1071
- cdef inline npy_datetime get_datetime64_value(object obj) nogil:
1071
+ cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:
1072
1072
"""
1073
1073
returns the int64 value underlying scalar numpy datetime64 object
1074
1074
@@ -1078,14 +1078,14 @@ cdef inline npy_datetime get_datetime64_value(object obj) nogil:
1078
1078
return (< PyDatetimeScalarObject* > obj).obval
1079
1079
1080
1080
1081
- cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:
1081
+ cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:
1082
1082
"""
1083
1083
returns the int64 value underlying scalar numpy timedelta64 object
1084
1084
"""
1085
1085
return (< PyTimedeltaScalarObject* > obj).obval
1086
1086
1087
1087
1088
- cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:
1088
+ cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:
1089
1089
"""
1090
1090
returns the unit part of the dtype for a numpy datetime64 object.
1091
1091
"""
0 commit comments