diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gobject/pygobject.c | 14 |
2 files changed, 17 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2006-11-18 Johan Dahlin <jdahlin@async.com.br> + + * gobject/pygobject.c (pygobject_register_class): set __module__ on + gobject derived types, fixes #376099 + 2006-11-18 Yevgen Muntyan <muntyan@tamu.edu> reviewed by: Johan Dahlin <johan@gnome.org> diff --git a/gobject/pygobject.c b/gobject/pygobject.c index 4cfe9e9..94ae09c 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -482,9 +482,9 @@ pygobject_register_class(PyObject *dict, const gchar *type_name, PyObject *o; const char *class_name, *s; PyObject *runtime_bases; - PyObject *bases_list, *bases; + PyObject *bases_list, *bases, *mod_name; int i; - + class_name = type->tp_name; s = strrchr(class_name, '.'); if (s != NULL) @@ -530,6 +530,16 @@ pygobject_register_class(PyObject *dict, const gchar *type_name, return; } + /* Set type.__module__ to the name of the module, + * otherwise it'll default to 'gobject', see #376099 + */ + s = strrchr(type->tp_name, '.'); + if (s != NULL) { + mod_name = PyString_FromStringAndSize(type->tp_name, (int)(s - type->tp_name)); + PyDict_SetItemString(type->tp_dict, "__module__", mod_name); + Py_DECREF(mod_name); + } + if (gtype) { o = pyg_type_wrapper_new(gtype); PyDict_SetItemString(type->tp_dict, "__gtype__", o); |