[C++-sig] Another bug in pyplusplus

Niall Douglas s_sourceforge at nedprod.com
Sun Jun 18 16:47:28 CEST 2006


On 18 Jun 2006 at 16:46, Roman Yakovenko wrote:

> On 6/18/06, Niall Douglas <s_sourceforge at nedprod.com> wrote:
> > No problem. I have the imageviewer.py example very nearly working.
> > Once it is working, I would consider the python bindings finished
> > apart from three items:
> >
> > 1. Named parameters do not work which is annoying because BPL throws
> > an exception if its type is as yet unregistered. This problem can't
> > be fixed by pyplusplus - it requires fixing BPL.
> 
> class_t has property - always_expose_using_scope. If you set it to true, then
> it can help you in next case:
> 
> struct A{
>     void do_smth( const A& a=A() ){...}
> };
> 
> Generated code will not throw exception, while registering the function.

I already have this set to true. I more meant:

void foo(int a=1, int b=2, int c=3)

... and then from python do:

foo(c=8)

You need to declare parameter names to do this, but BPL faults when 
the type is (say) an enum defined in the class it's about to declare.

> > 3. FXImage subclasses don't provide a working getData(). This
> > requires custom body text insertion to be added to pyplusplus.
> 
> Can you send short example what pyplusplus generates now and the code you need
> to be generated, may be I will find a solution.

All I need is the ability to insert custom code into the body of 
class files. Put simply, I need to insert DEFINEMAKECARRAYITER at the 
top of every FXImage.pypp.cpp, FXBMPImage.pypp.cpp, 
FXJPGImage.pypp.cpp etc.

It needs to go before or after the wrapper class. Declared inside the 
body.

If you add an overloads section (see previous email) containing all 
the BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS declarations (which MUST 
come after the wrapper class but before the register function), then 
I could add them there as a custom text code creator.

Cheers,
Niall






More information about the Cplusplus-sig mailing list