From d2c71ff53b42afec6bf4ebca3bcf801dce5cfbb2 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 20 Jul 2004 11:05:41 +0000 Subject: Simplify, fix name in exceptions and remove warning. * gtk/gtk.override (_wrap_gtk_file_chooser_dialog_new): Simplify, fix name in exceptions and remove warning. * gobject/pygenum.c (pyg_enum_from_gtype): Fall back to int for unregistered enums. * gobject/pygflags.c (pyg_flags_from_gtype): Ditto * gobject/gobjectmodule.c (initgobject): Rename back to MainLoop, MainContext --- gobject/pygenum.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gobject/pygenum.c') 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__"); -- cgit