[C++-sig] call policies help needed

Roman Yakovenko roman.yakovenko at gmail.com
Thu May 25 19:24:28 CEST 2006


On 5/25/06, Neal Becker <ndbecker2 at gmail.com> wrote:
>
> I'm confused.  I thought it worked like this:
>
> In python, create an a=A().  Then create a b=B(a).  Using
> custodian_and_ward, 'a' will not be deleted as long as 'b' is alive.  Then
> c=getA() using return_internal_reference will ensure that 'b' is not
> deleted as long as python holds 'c'.  Is this not correct?

Please, read my first post and the answer of David Abrahams.

"a" could be created from C++ and not from Python. In this case boost.python
library does not manage life time of object "a".

I think, that pyplusplus should generate "safe" code, and only after
this efficient.
Also, you can customize the return value policy

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list