From fd87703d4202c7272433f0a273ea787635920d9a Mon Sep 17 00:00:00 2001 From: jakirkham Date: Mon, 21 Oct 2024 13:32:37 -0700 Subject: [PATCH] Mark all `nogil` `cdef` functions as `noexcept` (#1085) 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. xref: https://github.com/rapidsai/kvikio/pull/502 Authors: - https://github.com/jakirkham Approvers: - Peter Andreas Entschev (https://github.com/pentschev) URL: https://github.com/rapidsai/ucx-py/pull/1085 --- ucp/_libs/arr.pyx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ucp/_libs/arr.pyx b/ucp/_libs/arr.pyx index 0c332ef3..1f2130f1 100644 --- a/ucp/_libs/arr.pyx +++ b/ucp/_libs/arr.pyx @@ -245,7 +245,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 @@ -263,7 +263,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 @@ -279,7 +279,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) @@ -292,7 +292,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]