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

Ravi lists_ravi at lavabit.com
Wed Oct 1 23:33:15 CEST 2008


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.

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

Regards,
Ravi





More information about the Cplusplus-sig mailing list