Re: [C++-sig] buildin converter for long double

2012-11-05 Thread jiangzuo...@gmail.com
how about return a wrap type of long double to cheating boost/python, and register youself converter as PyObject * o = PyArrayScalar_New(LongDouble); PyLongDoubleScalarObject * s = (PyLongDoubleScalarObject*)o; s->obval = value; Don't forget to call import_array() in your model init functio

[C++-sig] export custom C++ exception to Python so it can be raised by python

2012-11-05 Thread Martin Hellmich
Hi, I have a custom exception in C++ that I would like to use in Python. Let's call it MyException with custom constructor and members (an implementation is below). I would like to expose it to python so that I can raise it: > raise MyException(-1, 'tragic error') The perfect way that I can

[C++-sig] buildin converter for long double

2012-11-05 Thread Holger Brandsmeier
Dear list, the boost python buildin converter for long double: BOOST_PYTHON_TO_PYTHON_BY_VALUE(long double, ::PyFloat_FromDouble(x), &PyFloat_Type) converter/builtin_converters.hpp identifies long double, which on my system is a 128bit float, with a 64bit float in python. I would like to ident