From 6267aa32c891bb61d817ce2d44ac441e20a761a5 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Thu, 30 Nov 2023 13:54:01 -0500 Subject: add noexcept everywhere --- pyisda/date.pxd | 4 ++-- pyisda/date.pyx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyisda/date.pxd b/pyisda/date.pxd index 5072556..a150672 100644 --- a/pyisda/date.pxd +++ b/pyisda/date.pxd @@ -90,5 +90,5 @@ cpdef TDate pydate_to_TDate(c_datetime.date d) cpdef c_datetime.date TDate_to_pydate(TDate d) -cdef void _roll_date(TDate d, const double* tenors, int n_dates, TDate* output) nogil -cdef TDate _previous_twentieth(TDate d, bint roll, char* cal) nogil +cdef void _roll_date(TDate d, const double* tenors, int n_dates, TDate* output) noexcept nogil +cdef TDate _previous_twentieth(TDate d, bint roll, char* cal) noexcept nogil diff --git a/pyisda/date.pyx b/pyisda/date.pyx index 395d3b6..1af6d74 100644 --- a/pyisda/date.pyx +++ b/pyisda/date.pyx @@ -39,7 +39,7 @@ def dcc_tostring(int day_count): return c_string -cdef TDate _previous_twentieth(TDate d, bint roll, char* cal) nogil: +cdef TDate _previous_twentieth(TDate d, bint roll, char* cal) noexcept nogil: cdef TMonthDayYear mdy if JpmcdsDateToMDY(d, &mdy) != SUCCESS: return -1 @@ -53,7 +53,7 @@ cdef TDate _previous_twentieth(TDate d, bint roll, char* cal) nogil: return r -cdef inline void __previous_twentieth(TMonthDayYear* mdy) nogil: +cdef inline void __previous_twentieth(TMonthDayYear* mdy) noexcept nogil: if mdy.day < 20: if mdy.month == 1: mdy.month = 12 @@ -110,7 +110,7 @@ def cds_accrued(d, double coupon, bint include_cashflow=False, str cal="NONE"): return (date - date_prev)/360. * coupon -cdef TMonthDayYear _next_twentieth(TMonthDayYear* mdy) nogil: +cdef TMonthDayYear _next_twentieth(TMonthDayYear* mdy) noexcept nogil: if mdy.day > 20: if mdy.month == 12: mdy.month = 1 @@ -126,14 +126,14 @@ cdef TMonthDayYear _next_twentieth(TMonthDayYear* mdy) nogil: mdy.year += 1 -cdef inline TDate next_business_day(TDate date, long method, char* cal) nogil: +cdef inline TDate next_business_day(TDate date, long method, char* cal) noexcept nogil: cdef TDate r if JpmcdsBusinessDay(date, method, cal, &r) != SUCCESS: return -1 else: return r -cdef void _roll_date(TDate d, const double* tenors, int n_dates, TDate* output) nogil: +cdef void _roll_date(TDate d, const double* tenors, int n_dates, TDate* output) noexcept nogil: cdef: TDate cutoff = 151472 # 2015-09-20 TMonthDayYear d_rolled -- cgit v1.2.3-70-g09d2