[C++-sig] Re: Segfault when calling python method from C++

David Abrahams dave at boost-consulting.com
Mon Jul 28 15:46:41 CEST 2003

Pierre Barbier de Reuille <pierre.barbier at cirad.fr> writes:

> David Abrahams wrote:
>>Hmm, Joel just checked in some support for this.  See
> I didn't know this project. My goal, even if close, is somehow
> different: I want to be able to use the STL containers as if there
> were python list. 

How is that different from what Joel did?

> At best, anybody should be able to export its own container as a
> python list. But it could be a good idea to use what Joel did ...

What you did does not appear to export the container "as a python
list", but as a Python sequence.  Exporting "as a list" would be more
along the lines of the custom rvalue converters described in
http://www.boost.org/libs/python/doc/v2/faq.html#question2, I think.

>>>By the time, it only works with g++-3.2 or later, but it's just a
>>>question of namespace and include locations.  There is a _small_
>>>help at the beginning. The only thing not written is for the
>>>handling of the exceptions: you have to call define_stl_exceptions()
>>>in your module function. The wcc files correspond to your hpp ones
>>>and the hh is here for tiled compilation only.
>>The first thing I'd need in order to evaluate this is some examples
>>and documentation which describe what it does.
> Ok, I join an example of module along with a python test file. You
> just need to execute ths python file to test ...
> For the documentation I'm writing it and I'll send it to you as soon
> as possible.
>>>My main concern about what you said is about the Boost.Python test
>>>suite ... how to document myself about how it works ?
>>I can't understand what you mean.  Can you rephrase?  Testing and
>>documentation are two separate things; I want tests for
>>libs/python/test and documentation for libs/python/doc.
> I just wondered if you had any rule to write test suite. But if the
> kind of test I send you with this mail is ok ...

Actually, I would strongly prefer a test using the same format as all
of the other tests, with doctest or using the unittest module as
polymorphism.py does.

>>Oh, and BTW, the GPL is not Boost-compatible.
> Oh ... I didn't notice that ! By the way, what is the licence of
> Boost.Python ? I don't see any licence ! 

   Permission to copy, use, modify, sell and distribute this software
   is granted provided this copyright notice appears in all
   copies. This software is provided "as is" without express or
   implied warranty, and with no claim as to its suitability for any

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list