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

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Mon Jul 28 16:56:30 CEST 2003

David Abrahams wrote:

>How is that different from what Joel did?
Joel "just" did the hardest part ... what's missing are methods like 
append, extend, sort, revert ...
By the way, I cannot successfully compile his example and it only handle 
the vector container. (But it's better than what I did, mainly with his 
reference thing that allows you to delete the object without having 
dangling pointers and still permits to modify the list using the 
__getitem__ method, and probably because he seems to use a method more 
Then, there is also the exportation of mapping objects with the same 
behaviour as dict objects.

>>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.
You're right, but a more correct assertion would be that I want to 
export STL container so that they behave as close as possible to python 

>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.
Ok, that was what I wanted to know :o)

Pierre Barbier de Reuille

INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde

tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68 

More information about the Cplusplus-sig mailing list