[C++-sig] Return value policies for objects with custom to-python converters
Roman Yakovenko
roman.yakovenko at gmail.com
Fri Oct 3 20:22:22 CEST 2008
2008/10/2 Ravi <lists_ravi at lavabit.com>:
> Attached; hope you don't mind me using your code in my example.
No, I am glad you find it useful.
> Python code:
> import tuples
> x = tuples.get2() # works
> x = tuples.get1() # fails with conversion error
>
I could be wrong, but it seems to be Boost.Python bug. I would submit
bug report.
I thought about possible work around for you.
Basically you can wrap functionality that registers custom converters
and add that type to some global list. You can use
boost::python::type_info class for the type description.
Then you can create new call policy, that will query that list and
will execute library "reference_existing_object" or yours.
This solution is applicable if you have few types with custom
conversion and many functions.
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list