diff options
Diffstat (limited to 'gobject/pygobject.h')
-rw-r--r-- | gobject/pygobject.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gobject/pygobject.h b/gobject/pygobject.h index e75c890..21743ba 100644 --- a/gobject/pygobject.h +++ b/gobject/pygobject.h @@ -198,6 +198,7 @@ struct _PyGObject_Functions { gpointer data); gboolean (*gerror_exception_check) (GError **error); PyObject* (*option_group_new) (GOptionGroup *group); + GType (* type_from_object_strict) (PyObject *obj, gboolean strict); }; #ifndef _INSIDE_PYGOBJECT_ @@ -218,6 +219,7 @@ struct _PyGObject_Functions *_PyGObject_API; #define pygobject_watch_closure (_PyGObject_API->object_watch_closure) #define pyg_closure_set_exception_handler (_PyGObject_API->closure_set_exception_handler) #define pyg_destroy_notify (_PyGObject_API->destroy_notify) +#define pyg_type_from_object_strict (_PyGObject_API->type_from_object_strict) #define pyg_type_from_object (_PyGObject_API->type_from_object) #define pyg_type_wrapper_new (_PyGObject_API->type_wrapper_new) #define pyg_enum_get_value (_PyGObject_API->enum_get_value) @@ -352,8 +354,14 @@ pygobject_init(int req_major, int req_minor, int req_micro) } cobject = PyObject_GetAttrString(gobject, "_PyGObject_API"); +#if PY_VERSION_HEX >= 0x03000000 + if (cobject && PyCapsule_CheckExact(cobject)) + _PyGObject_API = (struct _PyGObject_Functions *) PyCapsule_GetPointer(cobject, "gobject._PyGObject_API"); + +#else if (cobject && PyCObject_Check(cobject)) _PyGObject_API = (struct _PyGObject_Functions *) PyCObject_AsVoidPtr(cobject); +#endif else { PyErr_SetString(PyExc_ImportError, "could not import gobject (could not find _PyGObject_API object)"); |