On Tue, Aug 17, 2010 at 16:35, Damien Caliste <[email protected]> wrote:
> Hello,
>
>   I'm porting my application to use GObject Introspection, and thus
> testing the Python bindings provided by pygobject-2.21.5. Thanks a lot
> for all these pieces of code, it really brings exciting new
> possibilities.
>
>   My issue is when using a prototype of function like this:
> /**
>  * setPlanetData:
>  * @nPlanets: number of planets in the solar system.
>  * @arrayDiameter: (in) (array length=nPlanets): diameters of planets.
>  * @arrayMass: (in) (array length=nPlanets): masses of planets.
>  *
>  * Set-up the number of planets and their characteristics.
>  */
> gboolean setPlanetData(gint nPlanets, gfloat *arrayDiameter, gflaot
> *arrayMass);
>
> The .gir file is properly created with a method, a return value and
> three parameters, two of them being arrays which length is given by
> parameter id=0.
>
> But, when using gi.repository in Python, my method setPlanetData takes
> exactly one argument while I was waiting for two.
>
> It cames from the method '_prepare_invocation_state' (file
> pygi-invoke.c) which counts the number of in auxiliary arguments. In
> case of an array, line 184, the argument positioned at
> length_arg_pos, is set auxiliary and n_aux_in_args is increased. But in
> my function case, the argument nPlanets in used twice and thus
> n_aux_in_args is incremented twice while nPlanets is a unique argument.
>
> There are two possibilities:
> - one should not write C functions with such a prototype, I may then
> suggest the attached patch1, adding a warn_if_fail when the argument
> has already the auxiliary flag.
> - one should count the argument as auxiliary, only if it is not already
> auxiliary, see the attached patch2.
>
> Thanks for reviewing this and giving your opinion. If this issue is
> relevant, I can open a bug and attached whatever patch is adapted.

I think is very relevant. I would go with the first possibility for now.

Thanks,

Tomeu

> Regards,
>
> Damien.
>
> _______________________________________________
> pygtk mailing list   [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to