diff options
-rw-r--r-- | gobject/gobjectmodule.c | 4 | ||||
-rw-r--r-- | gobject/pygenum.c | 4 | ||||
-rw-r--r-- | gobject/pygflags.c | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 9de16a5..6027254 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1843,8 +1843,8 @@ initgobject(void) PyGFlags_Type.tp_base = &PyInt_Type; REGISTER_GTYPE(d, PyGFlags_Type, "GFlags", G_TYPE_FLAGS); - REGISTER_TYPE(d, PyGMainLoop_Type, "GMainLoop"); - REGISTER_TYPE(d, PyGMainContext_Type, "GMainContext"); + REGISTER_TYPE(d, PyGMainLoop_Type, "MainLoop"); + REGISTER_TYPE(d, PyGMainContext_Type, "MainContext"); /* glib version */ tuple = Py_BuildValue ("(iii)", glib_major_version, glib_minor_version, diff --git a/gobject/pygenum.c b/gobject/pygenum.c index 0ccbb90..89f1616 100644 --- a/gobject/pygenum.c +++ b/gobject/pygenum.c @@ -131,7 +131,9 @@ pyg_enum_from_gtype (GType gtype, int value) g_return_val_if_fail(gtype != G_TYPE_INVALID, NULL); pyclass = (PyObject*)g_type_get_qdata(gtype, pygenum_class_key); - g_assert(pyclass != NULL); + /* Fall back to int */ + if (pyclass == NULL) + return PyInt_FromLong(value); values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, "__enum_values__"); diff --git a/gobject/pygflags.c b/gobject/pygflags.c index 24d44be..d210850 100644 --- a/gobject/pygflags.c +++ b/gobject/pygflags.c @@ -156,7 +156,8 @@ pyg_flags_from_gtype (GType gtype, int value) g_return_val_if_fail(gtype != G_TYPE_INVALID, NULL); pyclass = (PyObject*)g_type_get_qdata(gtype, pygflags_class_key); - g_assert(pyclass != NULL); + if (pyclass == NULL) + return PyInt_FromLong(value); values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, "__flags_values__"); |