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

David Abrahams dave at boost-consulting.com
Mon Jul 28 18:03:27 CEST 2003

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

> 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 "boost-like")
> Then, there is also the exportation of mapping objects with the same
> behaviour as dict objects.

OK; if you could find a way to integrate with Joel's work, it would
be great.  Perhaps the two of you could discuss the design and come
up with something?

>>>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 lists.

Yeah; since Guido refuses to define "sequence" I guess what I said was
meaningless ;->

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list