diff options
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | gobject/pygtype.c | 6 |
2 files changed, 12 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2008-07-27 Paul Pogonyshev <pogonyshev@gmx.net> + + * gobject/pygtype.c (pyg_enum_get_value): Issue warning if 'obj' + is a PyGEnum of wrong type, i.e. not matching 'enum_type' (bug + #503771). + 2008-07-26 Johan Dahlin <johan@gnome.org> reviewed by: <delete if not using a buddy> diff --git a/gobject/pygtype.c b/gobject/pygtype.c index eb5b0bc..b4d029b 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -428,6 +428,12 @@ pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val) } else if (PyInt_Check(obj)) { *val = PyInt_AsLong(obj); res = 0; + + if (PyObject_TypeCheck(obj, &PyGEnum_Type) && ((PyGEnum *) obj)->gtype != enum_type) { + g_warning("expected enumeration type %s, but got %s instead", + g_type_name(enum_type), + g_type_name(((PyGEnum *) obj)->gtype)); + } } else if (PyString_Check(obj)) { GEnumValue *info; char *str = PyString_AsString(obj); |
