diff options
| author | Paul Pogonyshev <pogonyshev@gmx.net> | 2009-04-17 23:57:27 +0300 |
|---|---|---|
| committer | Paul Pogonyshev <pogonyshev@gmx.net> | 2009-04-17 23:57:27 +0300 |
| commit | 4c18e963aa85577646651c531e3d5bfda0308934 (patch) | |
| tree | bff90de7ba848f001e5bb614634d052507aaddc4 /gobject | |
| parent | 05625be99d5365b261c2ec16ae59a94ff59b0fce (diff) | |
| download | pygobject-4c18e963aa85577646651c531e3d5bfda0308934.tar.gz pygobject-4c18e963aa85577646651c531e3d5bfda0308934.tar.xz pygobject-4c18e963aa85577646651c531e3d5bfda0308934.zip | |
2009-04-17 Paul Pogonyshev <pogonyshev@gmx.net>
Bug 568499 – CellRendererPixbuf stock-size property has wrong type
* gobject/pygtype.c (pyg_enum_get_value): Also accept long
integers.
Diffstat (limited to 'gobject')
| -rw-r--r-- | gobject/pygtype.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gobject/pygtype.c b/gobject/pygtype.c index a9b18a4..601ea83 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -422,6 +422,16 @@ pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val) g_type_name(enum_type), g_type_name(((PyGEnum *) obj)->gtype)); } + /* Dumb code duplication, but probably not worth it to have yet another macro. */ + } else if (PyLong_Check(obj)) { + *val = PyLong_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 (_PyUnicode_Check(obj)) { GEnumValue *info; char *str = _PyUnicode_AsString(obj); |
