[C++-sig] Another bug in pyplusplus
Niall Douglas
s_sourceforge at nedprod.com
Sun Jun 18 14:48:00 CEST 2006
On 18 Jun 2006 at 8:44, Roman Yakovenko wrote:
> On 6/18/06, Niall Douglas <s_sourceforge at nedprod.com> wrote:
> > If you disable use of keywords using
> > mb.calldefs().use_keywords=False, pyplusplus also stops inserting
> > default argument values into its wrappers eg;
>
> May I correct you? All wrappers have been generated without default
> arguments, right :-)?
> It has nothing to do with use_keywords
It's quite possible. However, I know when use_keywords is true, it
puts arg("x")=5 and such into declarations.
> > def args_declaration( self ):
> > args = []
> > boost_obj = algorithm.create_identifier( self,
> > '::boost::python::object' )
> > for index, arg in enumerate( self.declaration.arguments ):
> > result = arg.type.decl_string + ' ' +
> > self.argument_name(index)
> > if arg.default_value:
> > if not declarations.is_pointer( arg.type ) or
> > arg.default_value != '0':
> > result += '=%s' % arg.default_value
> > else:
> > result += '=%s()' % boost_obj
>
> I could be wrong, but it seems to me that we don't need
> " if not declarations.is_pointer( arg.type ) or arg.default_value != '0': "
> condition, just plain
> "result += '=%s' % arg.default_value"
> will do the job, right? Am I missing something?
No you're absolutely right. I wrote that email at something like 3am
last night and I hadn't quite tested it properly. What you wrote is
correct.
> > Another point - I believe the default_X function doesn't need to be
> > virtual. By making it so, you're introducing an unnecessary
> > inefficiency:
>
> Fixed.
>
> Thank you!
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.
2. FXWinShellLink causes pyplusplus to generate bad code. This is
because it uses unions.
3. FXImage subclasses don't provide a working getData(). This
requires custom body text insertion to be added to pyplusplus.
Otherwise, they're finished! Thanks for all the help!
Cheers,
Niall
More information about the Cplusplus-sig
mailing list