ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[C++-sig] object constructor + integer == fail
by loeb other posts by this author
Oct 13 2009 6:53AM messages near this date
Re: [C++-sig] Help with converters ... | Re: [C++-sig] object constructor + integer == fail
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
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@[...].org
http://mail.python.org/mailman/listinfo/cplusplus-sig
Thread:
loeb
Troy D. Straszheim
loeb

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved