Minimal amount of noexcept to make it compile with cython 3

This commit is contained in:
Marek Nečada 2023-12-24 16:35:27 +02:00
parent 53764f3dd1
commit bd98ff994b
4 changed files with 8 additions and 8 deletions

View File

@ -179,7 +179,7 @@ lorentz_drude = {
} }
cdef qpms_epsmu_t python_epsmu_generator(cdouble omega, const void *params): cdef qpms_epsmu_t python_epsmu_generator(cdouble omega, const void *params) noexcept:
cdef object fun = <object> params cdef object fun = <object> params
cdef qpms_epsmu_t em cdef qpms_epsmu_t em
em.eps, em.mu = fun(omega) em.eps, em.mu = fun(omega)

View File

@ -161,14 +161,14 @@ cdef class __ArcSphere:
def __init__(self, r): def __init__(self, r):
self.r = r self.r = r
cdef qpms_arc_function_retval_t userarc(double theta, const void *params): cdef qpms_arc_function_retval_t userarc(double theta, const void *params) noexcept:
cdef object fun = <object> params cdef object fun = <object> params
cdef qpms_arc_function_retval_t retval cdef qpms_arc_function_retval_t retval
retval.r, retval.beta = fun(theta) retval.r, retval.beta = fun(theta)
return retval return retval
cdef qpms_errno_t qpms_tmatrix_generator_pythoncallable( cdef qpms_errno_t qpms_tmatrix_generator_pythoncallable(
qpms_tmatrix_t *t, cdouble omega, const void *param): qpms_tmatrix_t *t, cdouble omega, const void *param) noexcept:
'''Use a python callable as a T-matrix generator '''Use a python callable as a T-matrix generator
fun is expected to be callable as fun is expected to be callable as

View File

@ -44,7 +44,7 @@ In simple words, it works like this:
# This one is probably not used anymore an can perhaps be removed: # This one is probably not used anymore an can perhaps be removed:
cdef void loop_D_iiiidddii_As_D_lllldddbl(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) nogil: cdef void loop_D_iiiidddii_As_D_lllldddbl(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) noexcept nogil:
cdef np.npy_intp i, n = dims[0] cdef np.npy_intp i, n = dims[0]
cdef void *func = (<void**>data)#[0] cdef void *func = (<void**>data)#[0]
#cdef char *func_name= <char*>(<void**>data)[1] # i am not using this, nor have I saved func_name to data #cdef char *func_name= <char*>(<void**>data)[1] # i am not using this, nor have I saved func_name to data
@ -142,7 +142,7 @@ ctypedef struct trans_calculator_get_X_data_t:
qpms_trans_calculator* c qpms_trans_calculator* c
void* cmethod void* cmethod
cdef void trans_calculator_loop_D_Ciiiidddii_As_D_lllldddbl(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) nogil: cdef void trans_calculator_loop_D_Ciiiidddii_As_D_lllldddbl(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) noexcept nogil:
cdef np.npy_intp i, n = dims[0] cdef np.npy_intp i, n = dims[0]
cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod
#cdef cdouble (*func)(qpms_trans_calculator*, int, int, int, int, double, double, double, int, int) nogil = (<trans_calculator_get_X_data_t*>data)[0].cmethod #cdef cdouble (*func)(qpms_trans_calculator*, int, int, int, int, double, double, double, int, int) nogil = (<trans_calculator_get_X_data_t*>data)[0].cmethod
@ -188,7 +188,7 @@ cdef void trans_calculator_loop_D_Ciiiidddii_As_D_lllldddbl(char **args, np.npy_
# sf_error.check_fpe(func_name) # sf_error.check_fpe(func_name)
cdef void trans_calculator_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) nogil: cdef void trans_calculator_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) noexcept nogil:
# E stands for error value (int), C for qpms_trans_calculator* # E stands for error value (int), C for qpms_trans_calculator*
cdef np.npy_intp i, n = dims[0] cdef np.npy_intp i, n = dims[0]
cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod
@ -241,7 +241,7 @@ cdef void trans_calculator_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np
@cython.boundscheck(False) @cython.boundscheck(False)
@cython.wraparound(False) @cython.wraparound(False)
cdef void trans_calculator_parallel_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) nogil: cdef void trans_calculator_parallel_loop_E_C_DD_iiiidddii_As_lllldddbl_DD(char **args, np.npy_intp *dims, np.npy_intp *steps, void *data) noexcept nogil:
# E stands for error value (int), C for qpms_trans_calculator* # E stands for error value (int), C for qpms_trans_calculator*
cdef np.npy_intp i, n = dims[0] cdef np.npy_intp i, n = dims[0]
cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod cdef void *func = (<trans_calculator_get_X_data_t*>data)[0].cmethod

View File

@ -31,7 +31,7 @@ cdef int pgsl_errno = 0
cdef int *pgsl_errno_ignorelist = NULL # list of ignored error codes, terminated by zero cdef int *pgsl_errno_ignorelist = NULL # list of ignored error codes, terminated by zero
# This error handler only sets the variables above # This error handler only sets the variables above
cdef void pgsl_error_handler(const char *reason, const char *_file, const int line, const int gsl_errno): cdef void pgsl_error_handler(const char *reason, const char *_file, const int line, const int gsl_errno) noexcept:
global pgsl_err_reason, pgsl_err_file, pgsl_err_line, pgsl_errno, pgsl_errno_ignorelist global pgsl_err_reason, pgsl_err_file, pgsl_err_line, pgsl_errno, pgsl_errno_ignorelist
cdef size_t i cdef size_t i
if(pgsl_errno_ignorelist): if(pgsl_errno_ignorelist):