[C++-sig] Return value policies for objects with custom to-python converters
Ravi
lists_ravi at lavabit.com
Mon Sep 29 20:17:25 CEST 2008
Hi,
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. However, the interface is unsatisying:
1. The _1 subscripts need to be removed. However, I could not find a way to
disambiguate types not exposed through boost.python and those with custom
converters. From the perspective of a library user, both the
reference_existing_object from boost.python and reference_existing_object_1
from the attached file accomplish exactly the same thing, but the user needs
to remember (and know) that certain classes need one vs the other. Could a
guru tell me how to plug my converter into boost.python's
reference_existing_object?
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?
3. If there is a satisfactory answer to 1, the resulting technique could be
added to boost.python. No new documentation would be necessary, since the
existing documentation would convey all the necessary information. In order to
submit a patch though, I suppose that some tests are needed. How would one
write tests for this functionality?
Regards,
Ravi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reference_existing_object_1.hpp
Type: text/x-c++hdr
Size: 1104 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080929/ca874a87/attachment.hpp>
More information about the Cplusplus-sig
mailing list