Commit 9b345b15 authored by Simon Feltman's avatar Simon Feltman

Use GObject type checking for instance arguments

Add a g_type_is_a check to interface/object instance arguments in addition
to the Python IsInstance check. This loosens restrictions on overrides which
don't use gi.overrides.override() and is needed to keep API compatibility
which broke with commit:
https://git.gnome.org/browse/pygobject/commit/?id=d5925b76

https://bugzilla.gnome.org/show_bug.cgi?id=724009
parent 419e13e1
......@@ -129,13 +129,17 @@ _pygi_marshal_from_py_interface_object (PyGIInvokeState *state,
gpointer *cleanup_data)
{
gboolean res = FALSE;
GObject *gobj = NULL;
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
if (py_arg == Py_None) {
arg->v_pointer = NULL;
return TRUE;
}
if (!PyObject_IsInstance (py_arg, ( (PyGIInterfaceCache *)arg_cache)->py_type)) {
gobj = pygobject_get (py_arg);
if (!PyObject_IsInstance (py_arg, iface_cache->py_type) &&
!g_type_is_a (G_OBJECT_TYPE (gobj), iface_cache->g_type)) {
PyObject *module = PyObject_GetAttrString(py_arg, "__module__");
PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment