[C++-sig] Pyste: set_wrapper on overloaded function or method

Nicodemus nicodemus at esss.com.br
Tue Mar 16 23:14:31 CET 2004


Dan Halbert wrote:

>I was trying to create a wrapper for an overloaded method using the
>Pyste "set_wrapper" capability (pyste from Boost 1.31.0). However, I ran
>into a problem which can be illustrated by the following example:
>
><snip example>
>The problem is that in Lines g and f above, the third args to ".def"
>are the wrong overloads to use. They are the overloads for the
>original method or function, not the wrapper overloads. The code
>should be:
>
>        .def("g", &g_wrapper, g_wrapper_overloads_1_2())    // corrected Line g
>
>    def("f", &f_wrapper, f_wrapper_overloads_0_1());        // corrected Line f
>
>If f_wrapper and g_wrapper had no overloads, there should be no third
>arg at all.
>
>I tried to fix this by patching ClassExporter.py around line 376,
>where the third arg to ".def" is constructed. I checked for a wrapper
>and tried to generate the overloads arg for the wrapper, not the
>method. But I was stymied because the wrapper object is not a
>full-fledged declaration object, and I can't get its min and max args.
>I'm still looking at the code, but perhaps someone more familar with
>it could suggest a fix.
>
>The same kind of fix would need to go into FunctionExporter.py.
>
>(In the example above, I would normally have done an
>Include("testing_wrapper.h"). I left it out for simplicity and also to
>force the BOOST_PYTHON_FUNCTION_OVERLOADS to occur.)
>
>  
>

Hi Dan,

I'm not ignoring this message, it's just that I haven't got time to look 
it through... I've been pretty busy. But expect a reply in the next few 
days.

Regards,
Nicodemus.





More information about the Cplusplus-sig mailing list