From 48638f23f8ebaa6d053bcf93e0db31c316442a10 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Wed, 16 Oct 2024 17:26:09 -0700 Subject: [PATCH] Mark all `nogil` `cdef` functions as `noexcept` These are all pure C functions implemented in Cython. They do not raise. Cython 3 adds checks for exceptions in these functions, which is unnecessary given none of these set exceptions. So add `noexcept` to turn off these Cython checks. --- python/kvikio/kvikio/_lib/arr.pyx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/kvikio/kvikio/_lib/arr.pyx b/python/kvikio/kvikio/_lib/arr.pyx index 45c7430313..d26b139e92 100644 --- a/python/kvikio/kvikio/_lib/arr.pyx +++ b/python/kvikio/kvikio/_lib/arr.pyx @@ -236,7 +236,7 @@ cdef class Array: cdef inline bint _c_contiguous(Py_ssize_t itemsize, Py_ssize_t ndim, Py_ssize_t[::1] shape_mv, - Py_ssize_t[::1] strides_mv) nogil: + Py_ssize_t[::1] strides_mv) noexcept nogil: cdef Py_ssize_t i, s if strides_mv is not None: s = itemsize @@ -254,7 +254,7 @@ cdef inline bint _c_contiguous(Py_ssize_t itemsize, cdef inline bint _f_contiguous(Py_ssize_t itemsize, Py_ssize_t ndim, Py_ssize_t[::1] shape_mv, - Py_ssize_t[::1] strides_mv) nogil: + Py_ssize_t[::1] strides_mv) noexcept nogil: cdef Py_ssize_t i, s if strides_mv is not None: s = itemsize @@ -270,7 +270,7 @@ cdef inline bint _f_contiguous(Py_ssize_t itemsize, cdef inline bint _contiguous(Py_ssize_t itemsize, Py_ssize_t ndim, Py_ssize_t[::1] shape_mv, - Py_ssize_t[::1] strides_mv) nogil: + Py_ssize_t[::1] strides_mv) noexcept nogil: cdef bint r = _c_contiguous(itemsize, ndim, shape_mv, strides_mv) if not r: r = _f_contiguous(itemsize, ndim, shape_mv, strides_mv) @@ -283,7 +283,7 @@ cdef inline bint _contiguous(Py_ssize_t itemsize, @wraparound(False) cdef inline Py_ssize_t _nbytes(Py_ssize_t itemsize, Py_ssize_t ndim, - Py_ssize_t[::1] shape_mv) nogil: + Py_ssize_t[::1] shape_mv) noexcept nogil: cdef Py_ssize_t i, nbytes = itemsize for i in range(ndim): nbytes *= shape_mv[i]