[C++-sig] Re: Parameter translation python, C++
Stefan Fleiter
sf.lists at web.de
Wed Aug 13 17:31:35 CEST 2003
Hi,
>>when I call a boost::python method from python
>>with a parameter of type float and there is only
>>a C++ Method with a parameter of type double
>>I get an "unidentifiable C++ exception".
>>C++-Code:
>>--------------------------------------------------------
>>void pybind(db::ExtCursor& cur, int column, float value)
Sorry, this is a double, I had two shells open and copied this from the
working version.
> I can't believe your compiler lets you get away with this.
No, g++ 3.2.3 would not do that. :-)
>> py::class_< db::ExtCursor, boost::noncopyable >("ExtCursor",
>> py::init< db::Connection& >())
>> .def("bind", bind4, "bind value to query")
>>}
>>
>>Python-Code:
>>--------------------------------------------------------
>>self._cCursor.bind(0, 2.3) // _cCursor is db::ExtCursor
> Anyway, the exception is either:
>
> 1. Actually a crash (most likely in your code), if you're running on
> windows. Try #including libs/python/test/module_tail.cpp in your
> module
I do run Linux.
I get the exception even if pybind is defined empty ( {} ).
> 2. A regular C++ exception thrown by your code for which you've not
> installed a translator.
See above, an empty method can't throw an exception.
And last but not least:
If I change "double" to "float" everything is ok.
Greets,
Stefan
More information about the Cplusplus-sig
mailing list