@@ -283,11 +283,11 @@ cdef extern from "numpy/arrayobject.h":
283
283
cdef int type_num
284
284
285
285
@property
286
- cdef inline npy_intp itemsize(self ) nogil:
286
+ cdef inline npy_intp itemsize(self ) noexcept nogil:
287
287
return PyDataType_ELSIZE(self )
288
288
289
289
@property
290
- cdef inline npy_intp alignment(self ) nogil:
290
+ cdef inline npy_intp alignment(self ) noexcept nogil:
291
291
return PyDataType_ALIGNMENT(self )
292
292
293
293
# Use fields/names with care as they may be NULL. You must check
@@ -304,11 +304,11 @@ cdef extern from "numpy/arrayobject.h":
304
304
# valid (the pointer can be NULL). Most users should access
305
305
# this field via the inline helper method PyDataType_SHAPE.
306
306
@property
307
- cdef inline PyArray_ArrayDescr* subarray(self ) nogil:
307
+ cdef inline PyArray_ArrayDescr* subarray(self ) noexcept nogil:
308
308
return PyDataType_SUBARRAY(self )
309
309
310
310
@property
311
- cdef inline npy_uint64 flags(self ) nogil:
311
+ cdef inline npy_uint64 flags(self ) noexcept nogil:
312
312
""" The data types flags."""
313
313
return PyDataType_FLAGS(self )
314
314
@@ -320,32 +320,32 @@ cdef extern from "numpy/arrayobject.h":
320
320
ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
321
321
322
322
@property
323
- cdef inline int numiter(self ) nogil:
323
+ cdef inline int numiter(self ) noexcept nogil:
324
324
""" The number of arrays that need to be broadcast to the same shape."""
325
325
return PyArray_MultiIter_NUMITER(self )
326
326
327
327
@property
328
- cdef inline npy_intp size(self ) nogil:
328
+ cdef inline npy_intp size(self ) noexcept nogil:
329
329
""" The total broadcasted size."""
330
330
return PyArray_MultiIter_SIZE(self )
331
331
332
332
@property
333
- cdef inline npy_intp index(self ) nogil:
333
+ cdef inline npy_intp index(self ) noexcept nogil:
334
334
""" The current (1-d) index into the broadcasted result."""
335
335
return PyArray_MultiIter_INDEX(self )
336
336
337
337
@property
338
- cdef inline int nd(self ) nogil:
338
+ cdef inline int nd(self ) noexcept nogil:
339
339
""" The number of dimensions in the broadcasted result."""
340
340
return PyArray_MultiIter_NDIM(self )
341
341
342
342
@property
343
- cdef inline npy_intp* dimensions(self ) nogil:
343
+ cdef inline npy_intp* dimensions(self ) noexcept nogil:
344
344
""" The shape of the broadcasted result."""
345
345
return PyArray_MultiIter_DIMS(self )
346
346
347
347
@property
348
- cdef inline void ** iters(self ) nogil:
348
+ cdef inline void ** iters(self ) noexcept nogil:
349
349
""" An array of iterator objects that holds the iterators for the arrays to be broadcast together.
350
350
On return, the iterators are adjusted for broadcasting."""
351
351
return PyArray_MultiIter_ITERS(self )
@@ -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