[C++-sig] object constructor + integer == fail
Daniel Löb
loeb at fkp.tu-darmstadt.de
Tue Oct 13 15:44:42 CEST 2009
Hi!
I seem to be unable to call the constructor of "object" with an integer
parameter.
Working example:
#include <boost/python.hpp>
#include <iostream>
using namespace boost::python;
using std::cout;
using std::endl;
int main()
{
object toast(3);
cout << extract<int>(toast) << endl;
}
It compiles just fine, but dies with a segmentation fault on execution
of the first line within main.
Backtrace:
0x00007ffff7ac9ca3 in PyInt_FromLong () from /usr/lib/libpython2.5.so.1.0
#1 0x0000000000401860 in arg_to_python (this=0x7fffffffeb30,
x=@0x7fffffffebdc) at
/usr/include/boost/python/converter/builtin_converters.hpp:113
#2 0x0000000000401888 in
boost::python::api::object_initializer_impl<false, false>::get<int>
(x=@0x7fffffffebdc)
at /usr/include/boost/python/object_core.hpp:374
#3 0x00000000004018cb in
boost::python::api::object_base_initializer<int> (x=@0x7fffffffebdc) at
/usr/include/boost/python/object_core.hpp:296
#4 0x00000000004018e7 in object<int> (this=0x7fffffffebd0,
x=@0x7fffffffebdc) at /usr/include/boost/python/object_core.hpp:315
#5 0x0000000000401196 in main () at bp_bug.cpp:10
Doing the same as above with a string instead of an integer works fine.
I'm running debian with libboost-python1.38.0 .
Greetings,
Daniel
More information about the Cplusplus-sig
mailing list