From 51e369e936e48289e73626060a908c6b4233d568 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 9 Aug 2005 12:54:22 +0000 Subject: Use the generic setattr protocol instead of getting the module's 2005-08-09 Andy Wingo * 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. --- gobject/pygobject.c | 5 ++--- 1 file 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 */ -- cgit