pygobject confused by new instance-parameter
Hello,
recent valac generates GIR that includes instance-parameter
xml nodes for methods, where previously methods didn't have parameters mentioned at all (in the GIR). See the following diff:
<method name="enable" c:identifier="peasy_plugin_enable">
<return-value transfer-ownership="full">
<type name="gboolean" c:type="gboolean"/>
</return-value>
+ <parameters>
+ <instance-parameter name="self" transfer-ownership="none">
+ <type name="Peasy.Plugin" c:type="PeasyPlugin*"/>
+ </instance-parameter>
+ </parameters>
</method>
<virtual-method name="enable" invoker="enable">
<return-value transfer-ownership="full">
<type name="gboolean" c:type="gboolean"/>
</return-value>
+ <parameters>
+ <instance-parameter name="self" transfer-ownership="none">
+ <type name="Peasy.Plugin" c:type="PeasyPlugin*"/>
+ </instance-parameter>
+ </parameters>
</virtual-method>
The C signature would be
struct PeasyPlugin {
gboolean (*enable)(PeasyPlugin *self)
}
(The relevant change to valac is here: vala@08f2af05)
A Python implementation of such a method looks like
def do_enable(self):
return True
When I call such a method from C (passing a _this
pointer), and the method is implemented by Python code via pygobject, then Python throws this error:
TypeError: do_enable() missing 1 required positional argument: 'self'
It seems that pygobject now generates two parameters, and obviously the caller only passes the one as before.
Is it possible that pygobject implicitly added a self parameter for methods, and is confused now that valac emits arguably more accurate GIR information?