Re: [pygccxml-development] code generation problem, py++ bug??
Brought to you by:
mbaas,
roman_yakovenko
|
From: Allen B. <al...@vr...> - 2007-01-10 14:51:49
|
Roman Yakovenko wrote:
> On 1/10/07, Allen Bierbaum <al...@vr...> wrote:
>> Roman:
>>
>> Note: I am e-mailing you directly because I have a bug report with a
>> rather large attachment so I didn't want to blanket everyone on the list
>> with the file.
>
> The support will be given on the mailing list. Thus my answers available to
> other users too.
Of course. As I said I just didn't want everyone to receive a 1MB file
in their e-mail. :)
>> If you extract the attached file it will create a directory called
>> pypp_vector_problem. There is a python py++ generation script, an
>> gccxml XML file, and example output. I have also attached the header
>> file that has the methods I am trying to wrap. I am using the latest
>> svn HEAD but I have also replicated this problem with several older
>> versions of Py++ from a couple months ago.
>
> I will appreciate if next time you at least will try to create small
> test case that
> reproduce the problem:
>
> #include <vector>
>
> namespace osg{
> struct node{};
> node* clone_tree( const std::vector<std::string>
> &types=std::vector<std::string>() );
> }
>
> That is all the code needed to reproduce the error.
Ok. I thought it was going to be more then that since the other methods
worked and this one didn't. I apologize for not stripping things down
further.
>> The problem is the 'bp::arg("...")=vector<' parts of the generated
>> code. This shows up for multiple of the generated methods. Because it
>> does not use std::vector the compiler can not build the code and fails
>> pretty miserably.
>>
>> I have checked older versions of Py++ and it looks like this has been
>> the way the code works for quite a while.
>>
>> Do you have any ideas? Is there something I am missing here or am I
>> just misusing Boost.Python in some way? Is it a bug in Py++?
>
> This is a gccxml bug:
> http://www.language-binding.net/pygccxml/design.html#patchers
> In this case I cannot create patcher. Also I hope I will be able to do
> this in future.
> I can explain why if you want.
>
> What should you do in order to compile the generated code:
> mb = module_builder_t( ....)
> mb.code_creator.add_namespace_usage( 'std' )
>
> This should solve the problem. The functionality presents even in very
> old version
> of Py++. If it does not help you have to change default value strings:
>
> for arg in f.arguments:
> arg.default_value = ...
>
> Or you can ask Py++ to generate code without default arguments:
> f.use_default_arguments = False
>
> Or you can use BOOST_PYTHON_FUNCTION_OVERLOADS macro as explained
> here: http://www.language-binding.net/pyplusplus/documentation/functions/overloading.html#overloading-using-macros
>
> You have plenty of options to deal with the bug
Ok. Thanks. One last question, is it possible for Py++ to detect that
this gccxml bug is happening and output a warning tell the user they
need to do something? I am guessing that it is not or you would have
already done it right. :)
I am only asking because for me as a user, I have to admit I probably
never would have traced this back to a bug in gccxml or this reference
on the webpage.
Thanks for the assistance.
-Allen
>
|