[C++-sig] pyplusplus tutorials & GUI wizard

Matthias Baas baas at ira.uka.de
Thu Feb 9 11:11:20 CET 2006


Roman Yakovenko wrote:
>> Why is the filter then called on
>> objects such as class methods where the return value of the filter has
>> no effect at all? It would be a little less confusing if the filter
>> wouldn't be called at all in those cases.
> 
> Because I did not think about it. Although question: If you exclude namespace,
> does it mean that you want to exclude all declaration found in that namespace?

I guess so. What other semantics would you suggest?
I was thinking that rejecting one node in the declaration tree actually 
prunes the entire subtree.

> May be it sound stupid, but I can not reproduce your problem. Sorry :-(
> I tried next function declaration and pyplusplus generates valid code:
> 
> fix_fundamental( unsigned int arg=(unsigned int)(0) );
> 
> bp::def( "fix_fundamental"
>             , &fundamental::fix_fundamental
>             , ( bp::arg("arg0")=0 )
>             , bp::default_call_policies() );

Sorry, the example in my previous mail was not the original example. I 
left away the actual default argument that I deemed only to be a minor 
detail, but as it turned out it's actually the key to produce the 
failure. Now here's another (verified!) example:

enum spam { eggs };
void foo(unsigned int v=eggs);

If I wrap this code pyplusplus generates:

     bp::def( "foo"
             , &foo
             , ( bp::arg("arg0")=unsigned int( ::::eggs ) )
             , bp::default_call_policies() );

This code generates a compile error (using gcc 3.3.4). You have to 
replace "unsigned int" with "(unsigned int)".
This example even reveals two more bugs that my original code doesn't 
show. The four colons before "eggs" also produce a compile error, this 
should only be two colons.
And then, for some reason, pyplusplus doesn't see the correct name ("v") 
of the argument and just calls it "arg0" in the bindings.

- Matthias -




More information about the Cplusplus-sig mailing list