summaryrefslogtreecommitdiffstats
path: root/gobject
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2004-08-04 12:04:01 +0000
committerJohan Dahlin <johan@src.gnome.org>2004-08-04 12:04:01 +0000
commite3135078a867a0dcd44647a480d990210e7496c2 (patch)
tree8104b5b1856c2b5a4944c1d1cadd80cedff64051 /gobject
parentbed044f5d6f69b376e45ac388322e9bf7484ae7e (diff)
downloadpygobject-e3135078a867a0dcd44647a480d990210e7496c2.tar.gz
pygobject-e3135078a867a0dcd44647a480d990210e7496c2.tar.xz
pygobject-e3135078a867a0dcd44647a480d990210e7496c2.zip
GdkModifierType is flags not an enum.
* gtk/gtk.override (_wrap_gtk_accel_map_lookup_entry): GdkModifierType is flags not an enum. * gobject/pygenum.c (pyg_enum_from_gtype): Don't crash if its not an enum * gobject/pygflags.c (pyg_flags_from_gtype): Don't crash if its not flags
Diffstat (limited to 'gobject')
-rw-r--r--gobject/pygenum.c2
-rw-r--r--gobject/pygflags.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/gobject/pygenum.c b/gobject/pygenum.c
index 24284d0..f7a6719 100644
--- a/gobject/pygenum.c
+++ b/gobject/pygenum.c
@@ -133,6 +133,8 @@ pyg_enum_from_gtype (GType gtype, int value)
pyclass = (PyObject*)g_type_get_qdata(gtype, pygenum_class_key);
if (pyclass == NULL) {
pyclass = pyg_enum_add(NULL, g_type_name(gtype), NULL, gtype);
+ if (!pyclass)
+ return PyInt_FromLong(value);
}
values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict,
diff --git a/gobject/pygflags.c b/gobject/pygflags.c
index 4a8211d..ca6eec0 100644
--- a/gobject/pygflags.c
+++ b/gobject/pygflags.c
@@ -156,9 +156,13 @@ 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);
- if (pyclass == NULL)
- return PyInt_FromLong(value);
+ if (pyclass == NULL) {
+ pyclass = pyg_flags_add(NULL, g_type_name(gtype), NULL, gtype);
+ if (!pyclass)
+ return PyInt_FromLong(value);
+ }
+
values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict,
"__flags_values__");
retval = PyDict_GetItem(values, PyInt_FromLong(value));