[C++-sig] Problem accessing bp::list attributes in C++

2008-10-30 Thread christophe grimault
Hi,

I wrote a function to speedup a part of my Python code that manipulates
python list objects. I do stg like:

void  Foo(numeric::array& X, numeric::array& Y, bool flag, list
max_points, list min_points,
list left_max_points, list 
right_max_points){
...
...
int Lmax =
boost::python::extract(max_points.attr("__len__")());
...
...
}

It compiles, but it crashes with segmentation fault, at the line where I
try get the length of max_points, 
which is a list.

I don't understand why !

any help ?

Thanks in advance

Chris
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Problem accessing bp::list attributes in C++

2008-10-30 Thread David Abrahams
Looks like you have a bug somewhere else. Trying to reduce this to a  
minimal reproducible case will doubtless help you find it.


Sent from my iPhone

On Oct 30, 2008, at 5:38 AM, christophe grimault <[EMAIL PROTECTED] 
> wrote:



Hi,

I wrote a function to speedup a part of my Python code that  
manipulates

python list objects. I do stg like:

void  Foo(numeric::array& X, numeric::array& Y, bool flag, list  
max_points, list min_points,

list left_max_points, list right_max_points){
...
...
int Lmax = boost::python::extract(max_points.attr("__len__") 
());

...
...
}

It compiles, but it crashes with segmentation fault, at the line  
where I try get the length of max_points,

which is a list.

I don't understand why !

any help ?

Thanks in advance

Chris
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


[C++-sig] new to python; old to C++

2008-10-30 Thread Alan Baljeu
Hi all.  

Question: which python-calling-C++ tool should I try?

Background:
I need to use Visual Studio 2005 native C++.  I know some tools use
gcc.  That's fine provided it's for something besides compiling my
application.

I'm looking at Python as a way to accelerate development of a C++ application.  
This application uses classes enough, but is largely not object oriented.  My 
thought is I would identify a bunch of C++ functions to wrap, wrap them, and 
then use Python to pull together new functionality.  The key to success is to 
make the C++ aspect of this wrapping as easy as possible.  I don't mean "less 
work" as much as I mean "obvious work that I'm liable to do right because it's 
simple".  If this means restrictions on what interfaces I can expose, I can 
live with that.

Simple means reducing the toolset I need to understand, keeping the input 
simple, and keeping the output simple.

Above all, "Not crashing" is a priority for me.

 Alan Baljeu


  __
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your 
favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig