Permalink
Browse files

- bumping Cython requirements to 0.16

- _rate_helpers updated to use proper ctypedef
- added a quantlib.termstructures._helpers common definition to be shared with
  the credit helpers for CDS
  • Loading branch information...
1 parent 54cefcd commit 51b46716972fd12c5ca25ae837034631fd3ca993 @dpinte dpinte committed May 25, 2012
Showing with 31 additions and 16 deletions.
  1. +3 −4 README
  2. +26 −0 quantlib/termstructures/_helpers.pxd
  3. +2 −12 quantlib/termstructures/yields/_rate_helpers.pxd
View
@@ -16,10 +16,9 @@ name. Suggestions are welcome!
Building the library
--------------------
-Builds are running fine under Cython 0.15 with the cython_0.15.patch applied
-(combines one pull request about templates with a unicode issue fix). Cython
-0.16 also requires a patch but pretty minimal (ctyon_0.16.patch).
-Needs to test it under 0.16 and see if things are fixed or report upstream.
+Builds are must be done with Cython 0.16 with the cython_0.16.patch applied
+(unicode issue fix). Cython 0.15 is not supported anymore as it does not
+support templated ctypedef.
The build and test suite can be run::
@@ -0,0 +1,26 @@
+"""
+ Copyright (C) 2011, Enthought Inc
+ Copyright (C) 2011, Patrick Henaff
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the license for more details.
+"""
+
+include '../types.pxi'
+
+from quantlib.handle cimport Handle
+from quantlib._quote cimport Quote
+
+
+cdef extern from 'ql/termstructures/bootstraphelper.hpp' namespace 'QuantLib':
+
+ cdef cppclass BootstrapHelper[T]:
+ BootstrapHelper() # added a fake constructor for Cython
+ BootstrapHelper(Handle[Quote]& quote)
+ BootstrapHelper(Real quote)
+ Handle[Quote] quote()
+
+ # Faking the typedef because not supported by Cython 0.15
+ cdef cppclass RelativeDateBootstrapHelper[T](BootstrapHelper):
+ pass
@@ -22,21 +22,11 @@ from quantlib.indexes._ibor_index cimport IborIndex
cimport quantlib.indexes._ibor_index as _ib
-cdef extern from 'ql/termstructures/bootstraphelper.hpp' namespace 'QuantLib':
-
- cdef cppclass BootstrapHelper[T]:
- BootstrapHelper(Handle[Quote]& quote)
- BoostrapHelper(Real quote)
-
- cdef cppclass RelativeDateBootstrapHelper[T](BootstrapHelper):
- pass
+from quantlib.termstructures._helpers cimport BootstrapHelper, RelativeDateBootstrapHelper
cdef extern from 'ql/termstructures/yield/ratehelpers.hpp' namespace 'QuantLib':
- # Cython does not support this ctypedef - thus trying to expose a class
- #ctypedef BootstrapHelper[YieldTermStructure] RateHelper
- cdef cppclass RateHelper:
- Handle[Quote] quote()
+ ctypedef BootstrapHelper[YieldTermStructure] RateHelper
cdef cppclass RelativeDateRateHelper:
Handle[Quote] quote()

0 comments on commit 51b4671

Please sign in to comment.