diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2017-11-30 13:22:25 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2017-11-30 13:32:38 -0500 |
| commit | 87bce7a101ca0a411c86e39a0f3c6904824b1722 (patch) | |
| tree | e752985da1c3169823677cc3afe3985b11b182f3 | |
| parent | c1ab19f96e2f127dd06330d6759da84809e1abad (diff) | |
| download | pyisda-87bce7a101ca0a411c86e39a0f3c6904824b1722.tar.gz | |
try __get/setstate__
| -rw-r--r-- | pyisda/credit_index.pyx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index 163f2f1..8c471f9 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -202,8 +202,11 @@ cdef class CurveList: copy.tickers = self.tickers return copy - def __reduce__(self): - return (self.__class__, (self.curves, self.weights)) + def __getstate__(self): + return (self.curves, self.weights) + + def __setstate__(self, state): + return self.__class__(*state) @cython.auto_pickle(False) cdef class CreditIndex(CurveList): @@ -276,9 +279,8 @@ cdef class CreditIndex(CurveList): copy.contingent_legs[i] = copyContingentLeg(self.contingent_legs[i]) return copy - def __reduce__(self): - return (self.__class__, - (TDate_to_pydate(self.start_date), self.maturities, self.curves, self.weights)) + def __getstate__(self): + return (TDate_to_pydate(self.start_date), self.maturities, self.curves, self.weights) def __hash__(self): cdef: |
