summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2023-12-06 15:22:00 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2023-12-06 15:22:00 -0500
commit0772db2b8ed46cbfc3cc2c18cbb985b10d4b9fe6 (patch)
treec9f218920adb529ae12a2907dcc06eb5b532ef87
parent91e26f9a55f61a9ffef6f9658f1b55b05e76ebb9 (diff)
downloadpyisda-0772db2b8ed46cbfc3cc2c18cbb985b10d4b9fe6.tar.gz
raise on error
-rw-r--r--pyisda/credit_index.pyx13
1 files changed, 11 insertions, 2 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx
index 65dc439..ea1a809 100644
--- a/pyisda/credit_index.pyx
+++ b/pyisda/credit_index.pyx
@@ -111,8 +111,17 @@ cdef class CurveList:
def __getitem__(self, tuple name not None):
cdef:
- char* buf = <char*>malloc(len(name[0]) + 3)
- char* tmp
+ DocClause doc_clause
+ Seniority sen
+ str ticker
+ pair[CurveName, size_t] p
+
+ try:
+ ticker, sen, doc_clause = name
+ except ValueError as e:
+ raise KeyError(str(e)) from None
+ cdef:
+ char* buf = <char*>malloc(len(ticker) + 3)
buf[0] = <char>sen
buf[1] = <char>doc_clause