diff options
author | Simon Feltman <sfeltman@src.gnome.org> | 2014-02-12 10:28:35 -0800 |
---|---|---|
committer | Simon Feltman <sfeltman@src.gnome.org> | 2014-02-12 10:28:35 -0800 |
commit | 9b345b153e86ca6c9b7290cf2ad3b38f6ad9d0e5 (patch) | |
tree | 01ce58918e7adeed15ba2ee3e844216612dfbc90 | |
parent | 419e13e1717b725d5c6815bae9672649b0afddd4 (diff) | |
download | pygobject-9b345b153e86ca6c9b7290cf2ad3b38f6ad9d0e5.tar.gz |
Use GObject type checking for instance arguments3.11.90
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
-rw-r--r-- | gi/pygi-object.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gi/pygi-object.c b/gi/pygi-object.c index 2aefee1d..29cd518a 100644 --- a/gi/pygi-object.c +++ b/gi/pygi-object.c @@ -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", |