summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2005-08-09 12:54:22 +0000
committerAndy Wingo <apwingo@src.gnome.org>2005-08-09 12:54:22 +0000
commit51e369e936e48289e73626060a908c6b4233d568 (patch)
tree1a5b20847d66bbf4f3c0f1f853d6eb8b75e009d6
parentc7479ac0dae2493683f032e1c7c1c5d38462106e (diff)
downloadpygobject-PYGTK_2_7_3.tar.gz
pygobject-PYGTK_2_7_3.tar.xz
pygobject-PYGTK_2_7_3.zip
Use the generic setattr protocol instead of getting the module'sPYGTK_2_7_3
2005-08-09 Andy Wingo <wingo@pobox.com> * gobject/pygobject.c (pygobject_new_with_interfaces): Use the generic setattr protocol instead of getting the module's dictionary and using setitem. Fixes bug #312999.
-rw-r--r--gobject/pygobject.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c
index 204fdbf..a7b1a33 100644
--- a/gobject/pygobject.c
+++ b/gobject/pygobject.c
@@ -643,9 +643,8 @@ pygobject_new_with_interfaces(GType gtype)
/* insert type name in module dict */
modules = PyImport_GetModuleDict();
if ((module = PyDict_GetItemString(modules, mod_name)) != NULL) {
- PyObject *mod_dict = PyModule_GetDict(module);
- if (mod_dict != NULL)
- PyDict_SetItemString(mod_dict, gtype_name, (PyObject *)type);
+ if (PyObject_SetAttrString(module, gtype_name, (PyObject *)type) < 0)
+ PyErr_Clear();
}
/* stash a pointer to the python class with the GType */