The length parameter of an (array length=n_param) is not removed if the array is the return value
Consider these 2 examples:
/**
* gimp_plug_in_test:
* @plug_in: a #GimpPlugIn.
* @n_procedures: (out): number of procedures.
*
* A test.
*
* Returns: (array length=n_procedures) (transfer full):
* the names of the procedures registered by @plug_in.
*/
gchar **
gimp_plug_in_test (GimpPlugIn *plug_in,
gint *n_procedures);
/**
* gimp_plug_in_test2:
* @plug_in: a #GimpPlugIn.
* @n_procedures: (out): number of procedures.
* @procedures: (out) (array length=n_procedures) (transfer full):
* the names of the procedures registered by @plug_in.
*
* A test.
*
*/
void
gimp_plug_in_test2 (GimpPlugIn *plug_in,
gint *n_procedures,
gchar ***procedures);
I would expect both to have the same signature in Python, and especially that n_procedures
would disappear since the array becomes a list in Python, which knows its length. Unfortunately they don't have the same signature, and n_procedures
disappear in the second case, but not when the array is the normal return value:
In [3]: Gimp.PlugIn.test.__doc__
Out[3]: 'test(self) -> list, n_procedures:int'
In [4]: Gimp.PlugIn.test2.__doc__
Out[4]: 'test2(self) -> procedures:list'
In the gir file, we got:
<method name="test" c:identifier="gimp_plug_in_test">
<doc xml:space="preserve"
filename="src/gimp/libgimp/gimpplugin.c"
line="228">A test.</doc>
<source-position filename="src/gimp/libgimp/gimpplugin.h" line="163"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="src/gimp/libgimp/gimpplugin.c"
line="235">
the names of the procedures registered by @plug_in.</doc>
<array length="0" zero-terminated="0" c:type="gchar**">
<type name="utf8"/>
</array>
</return-value>
<parameters>
<instance-parameter name="plug_in" transfer-ownership="none">
<doc xml:space="preserve"
filename="src/gimp/libgimp/gimpplugin.c"
line="230">a #GimpPlugIn.</doc>
<type name="PlugIn" c:type="GimpPlugIn*"/>
</instance-parameter>
<parameter name="n_procedures"
direction="out"
caller-allocates="0"
transfer-ownership="full">
<doc xml:space="preserve"
filename="src/gimp/libgimp/gimpplugin.c"
line="231">number of procedures.</doc>
<type name="gint" c:type="gint*"/>
</parameter>
</parameters>
</method>
<method name="test2" c:identifier="gimp_plug_in_test2">
<doc xml:space="preserve"
filename="src/gimp/libgimp/gimpplugin.c"
line="251">A test.</doc>
<source-position filename="src/gimp/libgimp/gimpplugin.h" line="166"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<instance-parameter name="plug_in" transfer-ownership="none">
<doc xml:space="preserve"
filename="src/gimp/libgimp/gimpplugin.c"
line="253">a #GimpPlugIn.</doc>
<type name="PlugIn" c:type="GimpPlugIn*"/>
</instance-parameter>
<parameter name="n_procedures"
direction="out"
caller-allocates="0"
transfer-ownership="full">
<doc xml:space="preserve"
filename="src/gimp/libgimp/gimpplugin.c"
line="254">number of procedures.</doc>
<type name="gint" c:type="gint*"/>
</parameter>
<parameter name="procedures"
direction="out"
caller-allocates="0"
transfer-ownership="full">
<doc xml:space="preserve"
filename="src/gimp/libgimp/gimpplugin.c"
line="255">
the names of the procedures registered by @plug_in.</doc>
<array length="0" zero-terminated="0" c:type="gchar***">
<type name="utf8" c:type="gchar**"/>
</array>
</parameter>
</parameters>
</method>