From 7e6419e0f0704c16ea744d997a7a3d016622885f Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Fri, 1 Nov 2024 17:41:00 +0200 Subject: [PATCH] fix: use of noexcept --- ext_src/_project.pyx | 24 ++++++++++++------------ setup.py | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ext_src/_project.pyx b/ext_src/_project.pyx index 8b74910..8927aed 100644 --- a/ext_src/_project.pyx +++ b/ext_src/_project.pyx @@ -27,7 +27,7 @@ cdef extern from "openmp.hpp" namespace "sphereproj": @cython.wraparound(False) cdef void interp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y, DTYPE_t z, - DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval) nogil: + DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval) noexcept nogil: cdef int Ngrid = d.shape[0] cdef DTYPE_t inv_delta = Ngrid/Lbox @@ -86,7 +86,7 @@ cdef void interp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y, @cython.wraparound(False) cdef void ngp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y, DTYPE_t z, - DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval) nogil: + DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval) noexcept nogil: cdef int Ngrid = d.shape[0] cdef DTYPE_t inv_delta = Ngrid/Lbox @@ -116,7 +116,7 @@ cdef void ngp3d_INTERNAL_periodic(DTYPE_t x, DTYPE_t y, @cython.wraparound(False) cdef void ngp3d_INTERNAL(DTYPE_t x, DTYPE_t y, DTYPE_t z, - DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval, DTYPE_t inval) nogil: + DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval, DTYPE_t inval) noexcept nogil: cdef int Ngrid = d.shape[0] cdef DTYPE_t inv_delta = Ngrid/Lbox @@ -145,7 +145,7 @@ cdef void ngp3d_INTERNAL(DTYPE_t x, DTYPE_t y, @cython.wraparound(False) cdef void interp3d_INTERNAL(DTYPE_t x, DTYPE_t y, DTYPE_t z, - DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval, DTYPE_t inval) nogil: + DTYPE_t[:,:,:] d, DTYPE_t Lbox, DTYPE_t *retval, DTYPE_t inval) noexcept nogil: cdef int Ngrid = d.shape[0] cdef DTYPE_t inv_delta = Ngrid/Lbox @@ -386,7 +386,7 @@ def interp2d(x not None, y not None, @cython.boundscheck(False) @cython.cdivision(True) cdef void INTERNAL_project_cic_no_mass(DTYPE_t[:,:,:] g, - DTYPE_t[:,:] x, int Ngrid, double Lbox, double shifter) nogil: + DTYPE_t[:,:] x, int Ngrid, double Lbox, double shifter) noexcept nogil: cdef double delta_Box = Ngrid/Lbox cdef int i cdef double a[3] @@ -419,7 +419,7 @@ cdef void INTERNAL_project_cic_no_mass(DTYPE_t[:,:,:] g, @cython.boundscheck(False) @cython.cdivision(True) cdef void INTERNAL_project_cic_no_mass_periodic(DTYPE_t[:,:,:] g, - DTYPE_t[:,:] x, int Ngrid, double Lbox, double shifter) nogil: + DTYPE_t[:,:] x, int Ngrid, double Lbox, double shifter) noexcept nogil: cdef double delta_Box = Ngrid/Lbox cdef int i cdef double a[3] @@ -462,7 +462,7 @@ cdef void INTERNAL_project_cic_no_mass_periodic(DTYPE_t[:,:,:] g, cdef void INTERNAL_project_cic_with_mass(DTYPE_t[:,:,:] g, DTYPE_t[:,:] x, DTYPE_t[:] mass, - int Ngrid, double Lbox, double shifter) nogil: + int Ngrid, double Lbox, double shifter) noexcept nogil: cdef double delta_Box = Ngrid/Lbox cdef int i cdef double a[3] @@ -499,7 +499,7 @@ cdef void INTERNAL_project_cic_with_mass(DTYPE_t[:,:,:] g, cdef void INTERNAL_project_cic_with_mass_periodic(DTYPE_t[:,:,:] g, DTYPE_t[:,:] x, DTYPE_t[:] mass, - int Ngrid, double Lbox, double shifter) nogil: + int Ngrid, double Lbox, double shifter) noexcept nogil: cdef double half_Box = 0.5*Lbox, m0 cdef double delta_Box = Ngrid/Lbox cdef int i @@ -680,7 +680,7 @@ cdef DTYPE_t cube_integral_trilin(DTYPE_t u[3], DTYPE_t u0[3], int r[1], DTYPE_t @cython.boundscheck(False) cdef DTYPE_t integrator0(DTYPE_t[:,:,:] density, - DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) nogil: + DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) noexcept nogil: cdef DTYPE_t d d = density[iu0[0], iu0[1], iu0[2]] @@ -689,7 +689,7 @@ cdef DTYPE_t integrator0(DTYPE_t[:,:,:] density, @cython.boundscheck(False) cdef DTYPE_t integrator1(DTYPE_t[:,:,:] density, - DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) nogil: + DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) noexcept nogil: cdef DTYPE_t vertex_value[8] cdef DTYPE_t d cdef int a[3][2] @@ -717,7 +717,7 @@ cdef DTYPE_t integrator1(DTYPE_t[:,:,:] density, cdef DTYPE_t C_line_of_sight_projection(DTYPE_t[:,:,:] density, DTYPE_t a_u[3], DTYPE_t min_distance, - DTYPE_t max_distance, DTYPE_t[:] shifter, int integrator_id) nogil except? 0: + DTYPE_t max_distance, DTYPE_t[:] shifter, int integrator_id) except? 0 nogil: cdef DTYPE_t u[3] cdef DTYPE_t ifu0[3] @@ -733,7 +733,7 @@ cdef DTYPE_t C_line_of_sight_projection(DTYPE_t[:,:,:] density, cdef int jumper[1] cdef DTYPE_t (*integrator)(DTYPE_t[:,:,:], - DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) nogil + DTYPE_t u[3], DTYPE_t u0[3], int u_delta[3], int iu0[3], int jumper[1], DTYPE_t alpha_max) noexcept nogil if integrator_id == 0: integrator = integrator0 diff --git a/setup.py b/setup.py index ae7f560..29f97fd 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ extensions = [ Extension( "sphereproj._project", sources=[ - "ext_src/_project.pyx", "ext_src/_project.cpp" + "ext_src/_project.pyx" ], include_dirs=["ext_src"], language="c++"