summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2023-11-30 13:54:01 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2023-11-30 13:54:01 -0500
commit6267aa32c891bb61d817ce2d44ac441e20a761a5 (patch)
tree88fa438a098a291455e307501f2481d160d1a521
parent01c5c58557edc3ec55781c3da49f4ef515a5683e (diff)
downloadpyisda-6267aa32c891bb61d817ce2d44ac441e20a761a5.tar.gz
add noexcept everywhere
-rw-r--r--pyisda/date.pxd4
-rw-r--r--pyisda/date.pyx10
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