[C++-sig] Return value policies for objects with custom to-python converters

Roman Yakovenko roman.yakovenko at gmail.com
Thu Oct 2 10:38:02 CEST 2008

On Thu, Oct 2, 2008 at 12:33 AM, Ravi <lists_ravi at lavabit.com> wrote:
> On Monday 29 September 2008 14:17:25 Ravi wrote:
>>   The return value policies from boost.python do not seem to handle objects
>> with custom converters; they seem to handle only those types exposed via
>> boost.python. Attached is some code that handles reference_existing_object
>> for objects with custom converters.
> Searching the web, I found that Roman Yakovenko has a similar converter in his
> Py++ code repository, but for some reason, his version is called
> return_ref_value rather than reference_existing_object_[some_suffix] and that
> his version does not handle references (only pointers). If Roman could not
> plug in his converter into the already-existing boost.python framework, I
> probably should not bother trying to do so.

Too many assumptions :-). Really.
* I am not that good in Boost.Python internals.
* I didn't need such functionality.

>> 2. So far, I have used only reference_existing_object. Do the other return
>> value policies need similar special handling for objects with custom
>> to-python converters? How do I figure out which ones do and which ones
>> don't?
> The other return value policies seem to be fine though I would like some
> assurance (from someone knowledgeable about boost.python internals) that only
> reference_existing_object needs to be rewritten to handle custom to-python
> converters.

You didn't presented small test case that reproduce the problem.
I suggest you to take a look on the following FAQ:


Roman Yakovenko
C++ Python language binding

More information about the Cplusplus-sig mailing list