]> granicus.if.org Git - python/commitdiff
Remove direct manipulation of the module dict.
authorFred Drake <fdrake@acm.org>
Wed, 3 Apr 2002 21:39:26 +0000 (21:39 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 3 Apr 2002 21:39:26 +0000 (21:39 +0000)
Modules/unicodedata.c

index 20b53a7cc4d74606f74a46f01253fe9c5385b916..6dcd31a8877c5f7c68902245336dc499de40894d 100644 (file)
@@ -463,21 +463,15 @@ static char *unicodedata_docstring = "unicode character database";
 DL_EXPORT(void)
 initunicodedata(void)
 {
-    PyObject *m, *d, *v;
+    PyObject *m, *v;
 
     m = Py_InitModule3(
         "unicodedata", unicodedata_functions, unicodedata_docstring);
     if (!m)
         return;
 
-    d = PyModule_GetDict(m);
-    if (!d)
-        return;
-
     /* Export C API */
     v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL);
-    if (v != NULL) {
-        PyDict_SetItemString(d, "ucnhash_CAPI", v);
-        Py_DECREF(v);
-    }
+    if (v != NULL)
+        PyModule_AddObject(m, "ucnhash_CAPI", v);
 }